File: qdomelement.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (256 lines) | stat: -rw-r--r-- 25,499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDomElement Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDomElement Class Reference<br /><sup><sup>[<a href="qtxml.html">QtXml</a> module]</sup></sup></h1><p>The QDomElement class represents one element in the DOM tree.
<a href="#details">More...</a></p>

<p>Inherits <a href="qdomnode.html">QDomNode</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdomelement.html#QDomElement">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#QDomElement-2">__init__</a></b> (<i>self</i>, QDomElement&#160;<i>x</i>)</li><li><div class="fn" />QString <b><a href="qdomelement.html#attribute">attribute</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>defaultValue</i>&#160;=&#160;'')</li><li><div class="fn" />QDomAttr <b><a href="qdomelement.html#attributeNode">attributeNode</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QDomAttr <b><a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</li><li><div class="fn" />QString <b><a href="qdomelement.html#attributeNS">attributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>, QString&#160;<i>defaultValue</i>&#160;=&#160;'')</li><li><div class="fn" />QDomNamedNodeMap <b><a href="qdomelement.html#attributes">attributes</a></b> (<i>self</i>)</li><li><div class="fn" />QDomNodeList <b><a href="qdomelement.html#elementsByTagName">elementsByTagName</a></b> (<i>self</i>, QString&#160;<i>tagname</i>)</li><li><div class="fn" />QDomNodeList <b><a href="qdomelement.html#elementsByTagNameNS">elementsByTagNameNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</li><li><div class="fn" />bool <b><a href="qdomelement.html#hasAttribute">hasAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />bool <b><a href="qdomelement.html#hasAttributeNS">hasAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</li><li><div class="fn" />QDomNode.NodeType <b><a href="qdomelement.html#nodeType">nodeType</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#removeAttribute">removeAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QDomAttr <b><a href="qdomelement.html#removeAttributeNode">removeAttributeNode</a></b> (<i>self</i>, QDomAttr&#160;<i>oldAttr</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#removeAttributeNS">removeAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttribute">setAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttribute-2">setAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttribute-3">setAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttribute-4">setAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttribute-5">setAttribute</a></b> (<i>self</i>, QString&#160;<i>name</i>, int&#160;<i>value</i>)</li><li><div class="fn" />QDomAttr <b><a href="qdomelement.html#setAttributeNode">setAttributeNode</a></b> (<i>self</i>, QDomAttr&#160;<i>newAttr</i>)</li><li><div class="fn" />QDomAttr <b><a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a></b> (<i>self</i>, QDomAttr&#160;<i>newAttr</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttributeNS">setAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, QString&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttributeNS-2">setAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttributeNS-3">setAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttributeNS-4">setAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setAttributeNS-5">setAttributeNS</a></b> (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, int&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qdomelement.html#setTagName">setTagName</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QString <b><a href="qdomelement.html#tagName">tagName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdomelement.html#text">text</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDomElement class represents one element in the DOM
tree.</p>
<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>
<p>Element attributes are represented by <a href="qdomattr.html">QDomAttr</a> objects that can be queried using the
<a href="qdomelement.html#attribute">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>
<p>If you want to access the text of a node use <a href="qdomelement.html#text">text</a>(), e.g.</p>
<pre class="cpp">
 <span class="type">QDomElement</span> e <span class="operator">=</span> <span class="comment">//...</span>
 <span class="comment">//...</span>
 <span class="type"><a href="qstring.html">QString</a></span> s <span class="operator">=</span> e<span class="operator">.</span><a href="qdomelement.html#text">text</a>()
</pre>
<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>
<pre class="cpp">
 <span class="type"><a href="qstring.html">QString</a></span> text;
 <span class="type">QDomElement</span> element <span class="operator">=</span> doc<span class="operator">.</span>documentElement();
 <span class="keyword">for</span>(<span class="type"><a href="qdomnode.html">QDomNode</a></span> n <span class="operator">=</span> element<span class="operator">.</span>firstChild(); <span class="operator">!</span>n<span class="operator">.</span>isNull(); n <span class="operator">=</span> n<span class="operator">.</span>nextSibling())
 {
     <span class="type"><a href="qdomtext.html">QDomText</a></span> t <span class="operator">=</span> n<span class="operator">.</span>toText();
     <span class="keyword">if</span> (<span class="operator">!</span>t<span class="operator">.</span>isNull())
         text <span class="operator">+</span><span class="operator">=</span> t<span class="operator">.</span>data();
 }
</pre>
<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>
<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>
<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>
<pre class="cpp">
 <span class="type"><a href="qdomdocument.html">QDomDocument</a></span> doc <span class="operator">=</span> <span class="comment">// ...</span>
 <span class="type">QDomElement</span> root <span class="operator">=</span> doc<span class="operator">.</span><a href="qdomnode.html#firstChildElement">firstChildElement</a>(<span class="string">"database"</span>);
 <span class="type">QDomElement</span> elt <span class="operator">=</span> root<span class="operator">.</span><a href="qdomnode.html#firstChildElement">firstChildElement</a>(<span class="string">"entry"</span>);
 <span class="keyword">for</span> (; <span class="operator">!</span>elt<span class="operator">.</span>isNull(); elt <span class="operator">=</span> elt<span class="operator">.</span>nextSiblingElement(<span class="string">"entry"</span>)) {
     <span class="comment">// ...</span>
 }
</pre>
<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>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDomElement" />QDomElement.__init__ (<i>self</i>)</h3><p>Constructs an empty element. Use the <a href="qdomdocument.html#createElement">QDomDocument.createElement</a>()
function to construct elements with content.</p>


<h3 class="fn"><a name="QDomElement-2" />QDomElement.__init__ (<i>self</i>, <a href="qdomelement.html">QDomElement</a>&#160;<i>x</i>)</h3><p>Constructs a copy of <i>x</i>.</p>
<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>


<h3 class="fn"><a name="attribute" />QString QDomElement.attribute (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>defaultValue</i>&#160;=&#160;'')</h3><p>Returns the attribute called <i>name</i>. If the attribute does
not exist <i>defValue</i> is returned.</p>
<p><b>See also</b> <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>


<h3 class="fn"><a name="attributeNode" /><a href="qdomattr.html">QDomAttr</a> QDomElement.attributeNode (<i>self</i>, QString&#160;<i>name</i>)</h3><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>
<p><b>See also</b> <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(),
<a href="qdomelement.html#attribute">attribute</a>(), <a href="qdomelement.html#setAttribute">setAttribute</a>(), and <a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a>().</p>


<h3 class="fn"><a name="attributeNodeNS" /><a href="qdomattr.html">QDomAttr</a> QDomElement.attributeNodeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</h3><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>
<p><b>See also</b> <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>(),
<a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(),
<a href="qdomelement.html#attribute">attribute</a>(), and <a href="qdomelement.html#setAttribute">setAttribute</a>().</p>


<h3 class="fn"><a name="attributeNS" />QString QDomElement.attributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>, QString&#160;<i>defaultValue</i>&#160;=&#160;'')</h3><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>
<p><b>See also</b> <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#attribute">attribute</a>().</p>


<h3 class="fn"><a name="attributes" /><a href="qdomnamednodemap.html">QDomNamedNodeMap</a> QDomElement.attributes (<i>self</i>)</h3><p>Returns a <a href="qdomnamednodemap.html">QDomNamedNodeMap</a>
containing all this element's attributes.</p>
<p><b>See also</b> <a href="qdomelement.html#attribute">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>


<h3 class="fn"><a name="elementsByTagName" /><a href="qdomnodelist.html">QDomNodeList</a> QDomElement.elementsByTagName (<i>self</i>, QString&#160;<i>tagname</i>)</h3><p>Returns a <a href="qdomnodelist.html">QDomNodeList</a>
containing all descendants of this element named <i>tagname</i>
encountered during a preorder traversal of the element subtree with
this element as its root. The order of the elements in the returned
list is the order they are encountered during the preorder
traversal.</p>
<p><b>See also</b> <a href="qdomelement.html#elementsByTagNameNS">elementsByTagNameNS</a>()
and <a href="qdomdocument.html#elementsByTagName">QDomDocument.elementsByTagName</a>().</p>


<h3 class="fn"><a name="elementsByTagNameNS" /><a href="qdomnodelist.html">QDomNodeList</a> QDomElement.elementsByTagNameNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</h3><p>Returns a <a href="qdomnodelist.html">QDomNodeList</a>
containing all descendants of this element with local name
<i>localName</i> and namespace URI <i>nsURI</i> encountered during
a preorder traversal of the element subtree with this element as
its root. The order of the elements in the returned list is the
order they are encountered during the preorder traversal.</p>
<p><b>See also</b> <a href="qdomelement.html#elementsByTagName">elementsByTagName</a>() and
<a href="qdomdocument.html#elementsByTagNameNS">QDomDocument.elementsByTagNameNS</a>().</p>


<h3 class="fn"><a name="hasAttribute" />bool QDomElement.hasAttribute (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Returns true if this element has an attribute called
<i>name</i>; otherwise returns false.</p>
<p><b>Note:</b> This function does not take the presence of
namespaces into account. As a result, the specified name will be
tested against fully-qualified attribute names that include any
namespace prefixes that may be present.</p>
<p>Use <a href="qdomelement.html#hasAttributeNS">hasAttributeNS</a>() to
explicitly test for attributes with specific namespaces and
names.</p>


<h3 class="fn"><a name="hasAttributeNS" />bool QDomElement.hasAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</h3><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>


<h3 class="fn"><a name="nodeType" /><a href="qdomnode.html#NodeType-enum">QDomNode.NodeType</a> QDomElement.nodeType (<i>self</i>)</h3><p>Returns <tt>ElementNode</tt>.</p>


<h3 class="fn"><a name="removeAttribute" />QDomElement.removeAttribute (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Removes the attribute called name <i>name</i> from this
element.</p>
<p><b>See also</b> <a href="qdomelement.html#setAttribute">setAttribute</a>(), <a href="qdomelement.html#attribute">attribute</a>(), and <a href="qdomelement.html#removeAttributeNS">removeAttributeNS</a>().</p>


<h3 class="fn"><a name="removeAttributeNode" /><a href="qdomattr.html">QDomAttr</a> QDomElement.removeAttributeNode (<i>self</i>, <a href="qdomattr.html">QDomAttr</a>&#160;<i>oldAttr</i>)</h3><p>Removes the attribute <i>oldAttr</i> from the element and
returns it.</p>
<p><b>See also</b> <a href="qdomelement.html#attributeNode">attributeNode</a>() and <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>().</p>


<h3 class="fn"><a name="removeAttributeNS" />QDomElement.removeAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>localName</i>)</h3><p>Removes the attribute with the local name <i>localName</i> and
the namespace URI <i>nsURI</i> from this element.</p>
<p><b>See also</b> <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>(), <a href="qdomelement.html#attributeNS">attributeNS</a>(), and <a href="qdomelement.html#removeAttribute">removeAttribute</a>().</p>


<h3 class="fn"><a name="setAttribute" />QDomElement.setAttribute (<i>self</i>, QString&#160;<i>name</i>, QString&#160;<i>value</i>)</h3><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>
<p><b>See also</b> <a href="qdomelement.html#attribute">attribute</a>(), <a href="qdomelement.html#setAttributeNode">setAttributeNode</a>(), and
<a href="qdomelement.html#setAttributeNS">setAttributeNS</a>().</p>


<h3 class="fn"><a name="setAttribute-2" />QDomElement.setAttribute (<i>self</i>, QString&#160;<i>name</i>, int&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>
<p>The number is formatted according to the current locale.</p>


<h3 class="fn"><a name="setAttribute-3" />QDomElement.setAttribute (<i>self</i>, QString&#160;<i>name</i>, int&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>
<p>The number is formatted according to the current locale.</p>


<h3 class="fn"><a name="setAttribute-4" />QDomElement.setAttribute (<i>self</i>, QString&#160;<i>name</i>, float&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>
<p>The number is formatted according to the current locale.</p>


<h3 class="fn"><a name="setAttribute-5" />QDomElement.setAttribute (<i>self</i>, QString&#160;<i>name</i>, int&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>
<p>The number is formatted according to the current locale.</p>


<h3 class="fn"><a name="setAttributeNode" /><a href="qdomattr.html">QDomAttr</a> QDomElement.setAttributeNode (<i>self</i>, <a href="qdomattr.html">QDomAttr</a>&#160;<i>newAttr</i>)</h3><p>Adds the attribute <i>newAttr</i> to this element.</p>
<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>
<p><b>See also</b> <a href="qdomelement.html#attributeNode">attributeNode</a>(), <a href="qdomelement.html#setAttribute">setAttribute</a>(), and <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>().</p>


<h3 class="fn"><a name="setAttributeNodeNS" /><a href="qdomattr.html">QDomAttr</a> QDomElement.setAttributeNodeNS (<i>self</i>, <a href="qdomattr.html">QDomAttr</a>&#160;<i>newAttr</i>)</h3><p>Adds the attribute <i>newAttr</i> to this element.</p>
<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>
<p><b>See also</b> <a href="qdomelement.html#attributeNodeNS">attributeNodeNS</a>(), <a href="qdomelement.html#setAttributeNS">setAttributeNS</a>(), and
<a href="qdomelement.html#setAttributeNode">setAttributeNode</a>().</p>


<h3 class="fn"><a name="setAttributeNS" />QDomElement.setAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, QString&#160;<i>value</i>)</h3><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>
<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>
<p><b>See also</b> <a href="qdomelement.html#attributeNS">attributeNS</a>(), <a href="qdomelement.html#setAttributeNodeNS">setAttributeNodeNS</a>(), and
<a href="qdomelement.html#setAttribute">setAttribute</a>().</p>


<h3 class="fn"><a name="setAttributeNS-2" />QDomElement.setAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, int&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>


<h3 class="fn"><a name="setAttributeNS-3" />QDomElement.setAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, int&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>


<h3 class="fn"><a name="setAttributeNS-4" />QDomElement.setAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, float&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>


<h3 class="fn"><a name="setAttributeNS-5" />QDomElement.setAttributeNS (<i>self</i>, QString&#160;<i>nsURI</i>, QString&#160;<i>qName</i>, int&#160;<i>value</i>)</h3><p>This is an overloaded function.</p>


<h3 class="fn"><a name="setTagName" />QDomElement.setTagName (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Sets this element's tag name to <i>name</i>.</p>
<p><b>See also</b> <a href="qdomelement.html#tagName">tagName</a>().</p>


<h3 class="fn"><a name="tagName" />QString QDomElement.tagName (<i>self</i>)</h3><p>Returns the tag name of this element. For an XML element like
this:</p>
<pre class="cpp">
 <span class="operator">&lt;</span>img src<span class="operator">=</span><span class="string">"myimg.png"</span><span class="operator">&gt;</span>
</pre>
<p>the tagname would return "img".</p>
<p><b>See also</b> <a href="qdomelement.html#setTagName">setTagName</a>().</p>


<h3 class="fn"><a name="text" />QString QDomElement.text (<i>self</i>)</h3><p>Returns the element's text or an empty string.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="operator">&lt;</span>h1<span class="operator">&gt;</span>Hello <span class="operator">&lt;</span>b<span class="operator">&gt;</span><span class="type"><a href="qt.html">Qt</a></span><span class="operator">&lt;</span><span class="operator">/</span>b<span class="operator">&gt;</span> <span class="operator">&lt;</span><span class="operator">!</span><span class="operator">[</span>CDATA<span class="operator">[</span><span class="operator">&lt;</span>xml is cool<span class="operator">&gt;</span><span class="operator">]</span><span class="operator">]</span><span class="operator">&gt;</span><span class="operator">&lt;</span><span class="operator">/</span>h1<span class="operator">&gt;</span>
</pre>
<p>The function text() of the <a href="qdomelement.html">QDomElement</a> for the <tt>&lt;h1&gt;</tt> tag,
will return the following text:</p>
<pre class="cpp">
 Hello <span class="type"><a href="qt.html">Qt</a></span> <span class="operator">&lt;</span>xml is cool<span class="operator">&gt;</span>
</pre>
<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>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>