You can access the attributes of an element with code like this:
.PP
.nf
.br
QDomElement e = //...
.br
//...
.br
QDomAttr a = e.attributeNode( "href" );
.br
cout << a.value() << endl; // prints "http://www.trolltech.com"
.br
a.setValue( "http://doc.trolltech.com" ); // change the node's attribute
.br
QDomAttr a2 = e.attributeNode( "href" );
.br
cout << a2.value() << endl; // prints "http://doc.trolltech.com"
.br
.fi
.PP
This example also shows that changing an attribute received from an element changes the attribute of the element. If you do not want to change the value of the element's attribute you must use cloneNode() to get an independent copy of the attribute.
.PP
QDomAttr can return the name() and value() of an attribute. An attribute's value is set with setValue(). If specified() returns TRUE the value was either set in the document or set with setValue(); otherwise the value hasn't been set. The node this attribute is attached to (if any) is returned by ownerElement().
.PP
For further information about the Document Object Model see http://www.w3.org/TR/REC-DOM-Level-1/ and http://www.w3.org/TR/DOM-Level-2-Core/. For a more general introduction of the DOM implementation see the QDomDocument documentation.
.PP
See also XML.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QDomAttr::QDomAttr ()"
Constructs an empty attribute.
.SH "QDomAttr::QDomAttr ( const QDomAttr & x )"
Constructs a copy of \fIx\fR.
.PP
The data of the copy is shared (shallow copy): modifying one node will also change the other. If you want to make a deep copy, use cloneNode().
Returns TRUE if the attribute has either been expicitly specified in the XML document or was set by the user with setValue(). Returns FALSE if the value hasn't been specified or set.