1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/xml/qdom.cpp -->
7
<title>Qt 4.0: QDomElement Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QDomElement Class Reference</h1>
21
<p>The QDomElement class represents one element in the DOM tree. <a href="#details">More...</a></p>
22
<pre>#include <QDomElement></pre><p>Part of the <a href="qtxml.html">QtXml</a> module.</p>
23
<p>Inherits <a href="qdomnode.html">QDomNode</a>.</p>
24
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
26
<li><a href="qdomelement-members.html">List of all members, including inherited members</a></li>
28
<a name="public-functions"></a>
29
<h3>Public Functions</h3>
31
<li><div class="fn"/><b><a href="qdomelement.html#QDomElement">QDomElement</a></b> ()</li>
32
<li><div class="fn"/><b><a href="qdomelement.html#QDomElement-2">QDomElement</a></b> ( const QDomElement & <i>x</i> )</li>
33
<li><div class="fn"/>QString <b><a href="qdomelement.html#attributex">attribute</a></b> ( const QString & <i>name</i>, const QString & <i>defValue</i> = QString() ) const</li>
34
<li><div class="fn"/>QString <b><a href="qdomelement.html#attributeNS">attributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>localName</i>, const QString & <i>defValue</i> = QString() ) const</li>
35
<li><div class="fn"/>QDomAttr <b><a href="qdomelement.html#attributeNode">attributeNode</a></b> ( const QString & <i>name</i> )</li>
36
<li><div class="fn"/>QDomAttr <b><a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a></b> ( const QString & <i>nsURI</i>, const QString & <i>localName</i> )</li>
37
<li><div class="fn"/>QDomNamedNodeMap <b><a href="qdomelement.html#attributes">attributes</a></b> () const</li>
38
<li><div class="fn"/>QDomNodeList <b><a href="qdomelement.html#elementsByTagName">elementsByTagName</a></b> ( const QString & <i>tagname</i> ) const</li>
39
<li><div class="fn"/>QDomNodeList <b><a href="qdomelement.html#elementsByTagNameNS">elementsByTagNameNS</a></b> ( const QString & <i>nsURI</i>, const QString & <i>localName</i> ) const</li>
40
<li><div class="fn"/>bool <b><a href="qdomelement.html#hasAttribute">hasAttribute</a></b> ( const QString & <i>name</i> ) const</li>
41
<li><div class="fn"/>bool <b><a href="qdomelement.html#hasAttributeNS">hasAttributeNS</a></b> ( const QString & <i>nsURI</i>, const QString & <i>localName</i> ) const</li>
42
<li><div class="fn"/>QDomNode::NodeType <b><a href="qdomelement.html#nodeType">nodeType</a></b> () const</li>
43
<li><div class="fn"/>void <b><a href="qdomelement.html#removeAttribute">removeAttribute</a></b> ( const QString & <i>name</i> )</li>
44
<li><div class="fn"/>void <b><a href="qdomelement.html#removeAttributeNS">removeAttributeNS</a></b> ( const QString & <i>nsURI</i>, const QString & <i>localName</i> )</li>
45
<li><div class="fn"/>QDomAttr <b><a href="qdomelement.html#removeAttributeNode">removeAttributeNode</a></b> ( const QDomAttr & <i>oldAttr</i> )</li>
46
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttribute">setAttribute</a></b> ( const QString & <i>name</i>, const QString & <i>value</i> )</li>
47
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttribute-2">setAttribute</a></b> ( const QString & <i>name</i>, int <i>value</i> )</li>
48
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttribute-3">setAttribute</a></b> ( const QString & <i>name</i>, uint <i>value</i> )</li>
49
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttribute-4">setAttribute</a></b> ( const QString & <i>name</i>, qlonglong <i>value</i> )</li>
50
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttribute-5">setAttribute</a></b> ( const QString & <i>name</i>, qulonglong <i>value</i> )</li>
51
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttribute-6">setAttribute</a></b> ( const QString & <i>name</i>, double <i>value</i> )</li>
52
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttributeNS">setAttributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>qName</i>, const QString & <i>value</i> )</li>
53
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttributeNS-2">setAttributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>qName</i>, int <i>value</i> )</li>
54
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttributeNS-3">setAttributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>qName</i>, uint <i>value</i> )</li>
55
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttributeNS-4">setAttributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>qName</i>, qlonglong <i>value</i> )</li>
56
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttributeNS-5">setAttributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>qName</i>, qulonglong <i>value</i> )</li>
57
<li><div class="fn"/>void <b><a href="qdomelement.html#setAttributeNS-6">setAttributeNS</a></b> ( const QString <i>nsURI</i>, const QString & <i>qName</i>, double <i>value</i> )</li>
58
<li><div class="fn"/>QDomAttr <b><a href="qdomelement.html#setAttributeNode">setAttributeNode</a></b> ( const QDomAttr & <i>newAttr</i> )</li>
59
<li><div class="fn"/>QDomAttr <b><a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a></b> ( const QDomAttr & <i>newAttr</i> )</li>
60
<li><div class="fn"/>void <b><a href="qdomelement.html#setTagName">setTagName</a></b> ( const QString & <i>name</i> )</li>
61
<li><div class="fn"/>QString <b><a href="qdomelement.html#tagName">tagName</a></b> () const</li>
62
<li><div class="fn"/>QString <b><a href="qdomelement.html#text">text</a></b> () const</li>
63
<li><div class="fn"/>QDomElement & <b><a href="qdomelement.html#operator-eq">operator=</a></b> ( const QDomElement & <i>x</i> )</li>
66
<li><div class="fn"/>63 public functions inherited from <a href="qdomnode.html#public-functions">QDomNode</a></li>
68
<a name="details"></a>
70
<h2>Detailed Description</h2>
71
<p>The QDomElement class represents one element in the DOM tree.</p>
72
<p>Elements have a <a href="qdomelement.html#tagName">tagName</a>() and zero or more attributes associated with them. The tag name can be changed with <a href="qdomelement.html#setTagName">setTagName</a>().</p>
73
<p>Element attributes are represented by <a href="qdomattr.html">QDomAttr</a> objects that can be queried using the <a href="qdomelement.html#attributex">attribute</a>() and <a href="qdomelement.html#attributeNode">attributeNode</a>() functions. You can set attributes with the <a href="qdomelement.html#setAttribute">setAttribute</a>() and <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>() functions. Attributes can be removed with <a href="qdomelement.html#removeAttribute">removeAttribute</a>(). There are namespace-aware equivalents to these functions, i.e. <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>(), <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>() and <a href="qdomelement.html#removeAttributeNS">removeAttributeNS</a>().</p>
74
<p>If you want to access the text of a node use <a href="qdomelement.html#text">text</a>(), e.g.</p>
75
<pre> QDomElement e = //...
77
QString s = e.text()</pre>
78
<p>The <a href="qdomelement.html#text">text</a>() function operates recursively to find the text (since not all elements contain text). If you want to find all the text in all of a node's children, iterate over the children looking for <a href="qdomtext.html">QDomText</a> nodes, e.g.</p>
79
<pre> QString text;
80
QDomElement element = doc.documentElement();
81
for(QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling())
83
QDomText t = n.toText();
87
<p>Note that we attempt to convert each node to a text node and use <a href="qdomelement.html#text">text</a>() rather than using <a href="qdomnode.html#firstChild">firstChild</a>().<a href="qdomnode.html#toText">toText</a>().data() or n.<a href="qdomnode.html#toText">toText</a>().data() directly on the node, because the node may not be a text element.</p>
88
<p>You can get a list of all the decendents of an element which have a specified tag name with <a href="qdomelement.html#elementsByTagName">elementsByTagName</a>() or <a href="qdomelement.html#elementsByTagNameNS">elementsByTagNameNS</a>().</p>
89
<p>To browse the elements of a dom document use <a href="qdomnode.html#firstChildElement">firstChildElement</a>(), <a href="qdomnode.html#lastChildElement">lastChildElement</a>(), <a href="qdomnode.html#nextSiblingElement">nextSiblingElement</a>() and <a href="qdomnode.html#previousSiblingElement">previousSiblingElement</a>(). For example, to iterate over all child elements called "entry" in a root element called "database", you can use:</p>
90
<pre> QDomDocument doc = // ...
91
QDomElement root = doc.firstChildElement("database");
92
QDomElement elt = root.firstChildElement("entry");
93
for (; !elt.isNull(); elt = elt.nextSiblingElelement("entry")) {
96
<p>For further information about the Document Object Model see <a href="http://www.w3.org/TR/REC-DOM-Level-1/">Level 1</a> and <a href="http://www.w3.org/TR/DOM-Level-2-Core/">Level 2 Core</a>. For a more general introduction of the DOM implementation see the <a href="qdomdocument.html">QDomDocument</a> documentation.</p>
98
<h2>Member Function Documentation</h2>
99
<h3 class="fn"><a name="QDomElement"></a>QDomElement::QDomElement ()</h3>
100
<p>Constructs an empty element. Use the <a href="qdomdocument.html#createElement">QDomDocument::createElement</a>() function to construct elements with content.</p>
101
<h3 class="fn"><a name="QDomElement-2"></a>QDomElement::QDomElement ( const QDomElement & <i>x</i> )</h3>
102
<p>Constructs a copy of <i>x</i>.</p>
103
<p>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 <a href="qdomnode.html#cloneNode">cloneNode</a>().</p>
104
<h3 class="fn"><a name="attributex"></a><a href="qstring.html">QString</a> QDomElement::attribute ( const <a href="qstring.html">QString</a> & <i>name</i>, const <a href="qstring.html">QString</a> & <i>defValue</i> = QString() ) const</h3>
105
<p>Returns the attribute called <i>name</i>. If the attribute does not exist <i>defValue</i> is returned.</p>
106
<p>See also <a href="qdomelement.html#setAttribute">setAttribute</a>(), <a href="qdomelement.html#attributeNode">attributeNode</a>(), <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(), and <a href="qdomelement.html#attributeNS">attributeNS</a>().</p>
107
<h3 class="fn"><a name="attributeNS"></a><a href="qstring.html">QString</a> QDomElement::attributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>localName</i>, const <a href="qstring.html">QString</a> & <i>defValue</i> = QString() ) const</h3>
108
<p>Returns the attribute with the local name <i>localName</i> and the namespace URI <i>nsURI</i>. If the attribute does not exist <i>defValue</i> is returned.</p>
109
<p>See also <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>(), <a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a>(), <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>(), and <a href="qdomelement.html#attributex">attribute</a>().</p>
110
<h3 class="fn"><a name="attributeNode"></a><a href="qdomattr.html">QDomAttr</a> QDomElement::attributeNode ( const <a href="qstring.html">QString</a> & <i>name</i> )</h3>
111
<p>Returns the <a href="qdomattr.html">QDomAttr</a> object that corresponds to the attribute called <i>name</i>. If no such attribute exists a <a href="qdomnode.html#isNull">null attribute</a> is returned.</p>
112
<p>See also <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(), <a href="qdomelement.html#attributex">attribute</a>(), <a href="qdomelement.html#setAttribute">setAttribute</a>(), and <a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a>().</p>
113
<h3 class="fn"><a name="attributeNodeNS"></a><a href="qdomattr.html">QDomAttr</a> QDomElement::attributeNodeNS ( const <a href="qstring.html">QString</a> & <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>localName</i> )</h3>
114
<p>Returns the <a href="qdomattr.html">QDomAttr</a> object that corresponds to the attribute with the local name <i>localName</i> and the namespace URI <i>nsURI</i>. If no such attribute exists a <a href="qdomnode.html#isNull">null attribute</a> is returned.</p>
115
<p>See also <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(), <a href="qdomelement.html#attributex">attribute</a>(), and <a href="qdomelement.html#setAttribute">setAttribute</a>().</p>
116
<h3 class="fn"><a name="attributes"></a><a href="qdomnamednodemap.html">QDomNamedNodeMap</a> QDomElement::attributes () const</h3>
117
<p>Returns a <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> containing all this element's attributes.</p>
118
<p>See also <a href="qdomelement.html#attributex">attribute</a>(), <a href="qdomelement.html#setAttribute">setAttribute</a>(), <a href="qdomelement.html#attributeNode">attributeNode</a>(), and <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>().</p>
119
<h3 class="fn"><a name="elementsByTagName"></a><a href="qdomnodelist.html">QDomNodeList</a> QDomElement::elementsByTagName ( const <a href="qstring.html">QString</a> & <i>tagname</i> ) const</h3>
120
<p>Returns a <a href="qdomnodelist.html">QDomNodeList</a> containing all descendent elements of this element that are called <i>tagname</i>. The order they are in the node list is the order they are encountered in a preorder traversal of the element tree.</p>
121
<p>See also <a href="qdomelement.html#elementsByTagNameNS">elementsByTagNameNS</a>() and <a href="qdomdocument.html#elementsByTagName">QDomDocument::elementsByTagName</a>().</p>
122
<h3 class="fn"><a name="elementsByTagNameNS"></a><a href="qdomnodelist.html">QDomNodeList</a> QDomElement::elementsByTagNameNS ( const <a href="qstring.html">QString</a> & <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>localName</i> ) const</h3>
123
<p>Returns a <a href="qdomnodelist.html">QDomNodeList</a> containing all the descendent elements of this element with the local name <i>localName</i> and the namespace URI <i>nsURI</i>. The order they are in the node list is the order they are encountered in a preorder traversal of the element tree.</p>
124
<p>See also <a href="qdomelement.html#elementsByTagName">elementsByTagName</a>() and <a href="qdomdocument.html#elementsByTagNameNS">QDomDocument::elementsByTagNameNS</a>().</p>
125
<h3 class="fn"><a name="hasAttribute"></a>bool QDomElement::hasAttribute ( const <a href="qstring.html">QString</a> & <i>name</i> ) const</h3>
126
<p>Returns true if this element has an attribute called <i>name</i>; otherwise returns false.</p>
127
<h3 class="fn"><a name="hasAttributeNS"></a>bool QDomElement::hasAttributeNS ( const <a href="qstring.html">QString</a> & <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>localName</i> ) const</h3>
128
<p>Returns true if this element has an attribute with the local name <i>localName</i> and the namespace URI <i>nsURI</i>; otherwise returns false.</p>
129
<h3 class="fn"><a name="nodeType"></a><a href="qdomnode.html#NodeType-enum">QDomNode::NodeType</a> QDomElement::nodeType () const</h3>
130
<p>Returns <tt>ElementNode</tt>.</p>
131
<h3 class="fn"><a name="removeAttribute"></a>void QDomElement::removeAttribute ( const <a href="qstring.html">QString</a> & <i>name</i> )</h3>
132
<p>Removes the attribute called name <i>name</i> from this element.</p>
133
<p>See also <a href="qdomelement.html#setAttribute">setAttribute</a>(), <a href="qdomelement.html#attributex">attribute</a>(), and <a href="qdomelement.html#removeAttributeNS">removeAttributeNS</a>().</p>
134
<h3 class="fn"><a name="removeAttributeNS"></a>void QDomElement::removeAttributeNS ( const <a href="qstring.html">QString</a> & <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>localName</i> )</h3>
135
<p>Removes the attribute with the local name <i>localName</i> and the namespace URI <i>nsURI</i> from this element.</p>
136
<p>See also <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>(), <a href="qdomelement.html#attributeNS">attributeNS</a>(), and <a href="qdomelement.html#removeAttribute">removeAttribute</a>().</p>
137
<h3 class="fn"><a name="removeAttributeNode"></a><a href="qdomattr.html">QDomAttr</a> QDomElement::removeAttributeNode ( const <a href="qdomattr.html">QDomAttr</a> & <i>oldAttr</i> )</h3>
138
<p>Removes the attribute <i>oldAttr</i> from the element and returns it.</p>
139
<p>See also <a href="qdomelement.html#attributeNode">attributeNode</a>() and <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>().</p>
140
<h3 class="fn"><a name="setAttribute"></a>void QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & <i>name</i>, const <a href="qstring.html">QString</a> & <i>value</i> )</h3>
141
<p>Adds an attribute called <i>name</i> with value <i>value</i>. If an attribute with the same name exists, its value is replaced by <i>value</i>.</p>
142
<p>See also <a href="qdomelement.html#attributex">attribute</a>(), <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(), and <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>().</p>
143
<h3 class="fn"><a name="setAttribute-2"></a>void QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & <i>name</i>, int <i>value</i> )</h3>
144
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
145
<h3 class="fn"><a name="setAttribute-3"></a>void QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & <i>name</i>, <a href="qtglobal.html#uint-typedef">uint</a> <i>value</i> )</h3>
146
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
147
<h3 class="fn"><a name="setAttribute-4"></a>void QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & <i>name</i>, <a href="qtglobal.html#qlonglong-typedef">qlonglong</a> <i>value</i> )</h3>
148
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
149
<h3 class="fn"><a name="setAttribute-5"></a>void QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & <i>name</i>, <a href="qtglobal.html#qulonglong-typedef">qulonglong</a> <i>value</i> )</h3>
150
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
151
<h3 class="fn"><a name="setAttribute-6"></a>void QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & <i>name</i>, double <i>value</i> )</h3>
152
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
153
<h3 class="fn"><a name="setAttributeNS"></a>void QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>qName</i>, const <a href="qstring.html">QString</a> & <i>value</i> )</h3>
154
<p>Adds an attribute with the qualified name <i>qName</i> and the namespace URI <i>nsURI</i> with the value <i>value</i>. If an attribute with the same local name and namespace URI exists, its prefix is replaced by the prefix of <i>qName</i> and its value is repaced by <i>value</i>.</p>
155
<p>Although <i>qName</i> is the qualified name, the local name is used to decide if an existing attribute's value should be replaced.</p>
156
<p>See also <a href="qdomelement.html#attributeNS">attributeNS</a>(), <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>(), and <a href="qdomelement.html#setAttribute">setAttribute</a>().</p>
157
<h3 class="fn"><a name="setAttributeNS-2"></a>void QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>qName</i>, int <i>value</i> )</h3>
158
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
159
<h3 class="fn"><a name="setAttributeNS-3"></a>void QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>qName</i>, <a href="qtglobal.html#uint-typedef">uint</a> <i>value</i> )</h3>
160
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
161
<h3 class="fn"><a name="setAttributeNS-4"></a>void QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>qName</i>, <a href="qtglobal.html#qlonglong-typedef">qlonglong</a> <i>value</i> )</h3>
162
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
163
<h3 class="fn"><a name="setAttributeNS-5"></a>void QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>qName</i>, <a href="qtglobal.html#qulonglong-typedef">qulonglong</a> <i>value</i> )</h3>
164
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
165
<h3 class="fn"><a name="setAttributeNS-6"></a>void QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> <i>nsURI</i>, const <a href="qstring.html">QString</a> & <i>qName</i>, double <i>value</i> )</h3>
166
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
167
<h3 class="fn"><a name="setAttributeNode"></a><a href="qdomattr.html">QDomAttr</a> QDomElement::setAttributeNode ( const <a href="qdomattr.html">QDomAttr</a> & <i>newAttr</i> )</h3>
168
<p>Adds the attribute <i>newAttr</i> to this element.</p>
169
<p>If the element has another attribute that has the same name as <i>newAttr</i>, this function replaces that attribute and returns it; otherwise the function returns a <a href="qdomnode.html#isNull">null attribute</a>.</p>
170
<p>See also <a href="qdomelement.html#attributeNode">attributeNode</a>(), <a href="qdomelement.html#setAttribute">setAttribute</a>(), and <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>().</p>
171
<h3 class="fn"><a name="setAttributeNodeNS"></a><a href="qdomattr.html">QDomAttr</a> QDomElement::setAttributeNodeNS ( const <a href="qdomattr.html">QDomAttr</a> & <i>newAttr</i> )</h3>
172
<p>Adds the attribute <i>newAttr</i> to this element.</p>
173
<p>If the element has another attribute that has the same local name and namespace URI as <i>newAttr</i>, this function replaces that attribute and returns it; otherwise the function returns a <a href="qdomnode.html#isNull">null attribute</a>.</p>
174
<p>See also <a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a>(), <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>(), and <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>().</p>
175
<h3 class="fn"><a name="setTagName"></a>void QDomElement::setTagName ( const <a href="qstring.html">QString</a> & <i>name</i> )</h3>
176
<p>Sets this element's tag name to <i>name</i>.</p>
177
<p>See also <a href="qdomelement.html#tagName">tagName</a>().</p>
178
<h3 class="fn"><a name="tagName"></a><a href="qstring.html">QString</a> QDomElement::tagName () const</h3>
179
<p>Returns the tag name of this element. For an XML element like this:</p>
180
<pre> <img src="myimg.png"></pre>
181
<p>the tagname would return "img".</p>
182
<p>See also <a href="qdomelement.html#setTagName">setTagName</a>().</p>
183
<h3 class="fn"><a name="text"></a><a href="qstring.html">QString</a> QDomElement::text () const</h3>
184
<p>Returns the element's text or an empty string.</p>
186
<pre> <h1>Hello <b>Qt</b> <![CDATA[<xml is cool>]]></h1></pre>
187
<p>The function text() of the <a href="qdomelement.html">QDomElement</a> for the &lt;h1&gt; tag, will return "Hello Qt &lt;xml is cool&gt;".</p>
188
<p>Comments are ignored by this function. It only evaluates <a href="qdomtext.html">QDomText</a> and <a href="qdomcdatasection.html">QDomCDATASection</a> objects.</p>
189
<h3 class="fn"><a name="operator-eq"></a>QDomElement & QDomElement::operator= ( const QDomElement & <i>x</i> )</h3>
190
<p>Assigns <i>x</i> to this DOM element.</p>
191
<p>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 <a href="qdomnode.html#cloneNode">cloneNode</a>().</p>
192
<p /><address><hr /><div align="center">
193
<table width="100%" cellspacing="0" border="0"><tr class="address">
194
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
195
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
196
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
197
</tr></table></div></address></body>