1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/xml/qdom.cpp:4118 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QDomElement Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDomElement Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QDomElement class represents one element in the DOM tree.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when Qt is built with thread support.</p>
|
---|
37 | <p><tt>#include <<a href="qdom-h.html">qdom.h</a>></tt>
|
---|
38 | <p>Inherits <a href="qdomnode.html">QDomNode</a>.
|
---|
39 | <p><a href="qdomelement-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QDomElement"><b>QDomElement</b></a> ()</li>
|
---|
43 | <li class=fn><a href="#QDomElement-2"><b>QDomElement</b></a> ( const QDomElement & x )</li>
|
---|
44 | <li class=fn>QDomElement & <a href="#operator-eq"><b>operator=</b></a> ( const QDomElement & x )</li>
|
---|
45 | <li class=fn><a href="#~QDomElement"><b>~QDomElement</b></a> ()</li>
|
---|
46 | <li class=fn>QString <a href="#attribute"><b>attribute</b></a> ( const QString & name, const QString & defValue = QString::null ) const</li>
|
---|
47 | <li class=fn>void <a href="#setAttribute"><b>setAttribute</b></a> ( const QString & name, const QString & value )</li>
|
---|
48 | <li class=fn>void <a href="#setAttribute-2"><b>setAttribute</b></a> ( const QString & name, int value )</li>
|
---|
49 | <li class=fn>void <a href="#setAttribute-3"><b>setAttribute</b></a> ( const QString & name, uint value )</li>
|
---|
50 | <li class=fn>void <a href="#setAttribute-4"><b>setAttribute</b></a> ( const QString & name, long value )</li>
|
---|
51 | <li class=fn>void <a href="#setAttribute-5"><b>setAttribute</b></a> ( const QString & name, ulong value )</li>
|
---|
52 | <li class=fn>void <a href="#setAttribute-6"><b>setAttribute</b></a> ( const QString & name, double value )</li>
|
---|
53 | <li class=fn>void <a href="#removeAttribute"><b>removeAttribute</b></a> ( const QString & name )</li>
|
---|
54 | <li class=fn>QDomAttr <a href="#attributeNode"><b>attributeNode</b></a> ( const QString & name )</li>
|
---|
55 | <li class=fn>QDomAttr <a href="#setAttributeNode"><b>setAttributeNode</b></a> ( const QDomAttr & newAttr )</li>
|
---|
56 | <li class=fn>QDomAttr <a href="#removeAttributeNode"><b>removeAttributeNode</b></a> ( const QDomAttr & oldAttr )</li>
|
---|
57 | <li class=fn>virtual QDomNodeList <a href="#elementsByTagName"><b>elementsByTagName</b></a> ( const QString & tagname ) const</li>
|
---|
58 | <li class=fn>bool <a href="#hasAttribute"><b>hasAttribute</b></a> ( const QString & name ) const</li>
|
---|
59 | <li class=fn>QString <a href="#attributeNS"><b>attributeNS</b></a> ( const QString nsURI, const QString & localName, const QString & defValue ) const</li>
|
---|
60 | <li class=fn>void <a href="#setAttributeNS"><b>setAttributeNS</b></a> ( const QString nsURI, const QString & qName, const QString & value )</li>
|
---|
61 | <li class=fn>void <a href="#setAttributeNS-2"><b>setAttributeNS</b></a> ( const QString nsURI, const QString & qName, int value )</li>
|
---|
62 | <li class=fn>void <a href="#setAttributeNS-3"><b>setAttributeNS</b></a> ( const QString nsURI, const QString & qName, uint value )</li>
|
---|
63 | <li class=fn>void <a href="#setAttributeNS-4"><b>setAttributeNS</b></a> ( const QString nsURI, const QString & qName, long value )</li>
|
---|
64 | <li class=fn>void <a href="#setAttributeNS-5"><b>setAttributeNS</b></a> ( const QString nsURI, const QString & qName, ulong value )</li>
|
---|
65 | <li class=fn>void <a href="#setAttributeNS-6"><b>setAttributeNS</b></a> ( const QString nsURI, const QString & qName, double value )</li>
|
---|
66 | <li class=fn>void <a href="#removeAttributeNS"><b>removeAttributeNS</b></a> ( const QString & nsURI, const QString & localName )</li>
|
---|
67 | <li class=fn>QDomAttr <a href="#attributeNodeNS"><b>attributeNodeNS</b></a> ( const QString & nsURI, const QString & localName )</li>
|
---|
68 | <li class=fn>QDomAttr <a href="#setAttributeNodeNS"><b>setAttributeNodeNS</b></a> ( const QDomAttr & newAttr )</li>
|
---|
69 | <li class=fn>virtual QDomNodeList <a href="#elementsByTagNameNS"><b>elementsByTagNameNS</b></a> ( const QString & nsURI, const QString & localName ) const</li>
|
---|
70 | <li class=fn>bool <a href="#hasAttributeNS"><b>hasAttributeNS</b></a> ( const QString & nsURI, const QString & localName ) const</li>
|
---|
71 | <li class=fn>QString <a href="#tagName"><b>tagName</b></a> () const</li>
|
---|
72 | <li class=fn>void <a href="#setTagName"><b>setTagName</b></a> ( const QString & name )</li>
|
---|
73 | <li class=fn>virtual QDomNamedNodeMap <a href="#attributes"><b>attributes</b></a> () const</li>
|
---|
74 | <li class=fn>virtual QDomNode::NodeType <a href="#nodeType"><b>nodeType</b></a> () const</li>
|
---|
75 | <li class=fn>virtual bool <a href="#isElement"><b>isElement</b></a> () const</li>
|
---|
76 | <li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
---|
77 | </ul>
|
---|
78 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
79 |
|
---|
80 |
|
---|
81 |
|
---|
82 | The QDomElement class represents one element in the DOM tree.
|
---|
83 |
|
---|
84 | <p>
|
---|
85 |
|
---|
86 | <p> Elements have a <a href="#tagName">tagName</a>() and zero or more attributes associated
|
---|
87 | with them. The tag name can be changed with <a href="#setTagName">setTagName</a>().
|
---|
88 | <p> Element attributes are represented by <a href="qdomattr.html">QDomAttr</a> objects that can
|
---|
89 | be queried using the <a href="#attribute">attribute</a>() and <a href="#attributeNode">attributeNode</a>() functions.
|
---|
90 | You can set attributes with the <a href="#setAttribute">setAttribute</a>() and
|
---|
91 | <a href="#setAttributeNode">setAttributeNode</a>() functions. Attributes can be removed with
|
---|
92 | <a href="#removeAttribute">removeAttribute</a>(). There are namespace-aware equivalents to these
|
---|
93 | functions, i.e. <a href="#setAttributeNS">setAttributeNS</a>(), <a href="#setAttributeNodeNS">setAttributeNodeNS</a>() and
|
---|
94 | <a href="#removeAttributeNS">removeAttributeNS</a>().
|
---|
95 | <p> If you want to access the text of a node use <a href="#text">text</a>(), e.g.
|
---|
96 | <pre>
|
---|
97 | QDomElement e = //...
|
---|
98 | //...
|
---|
99 | <a href="qstring.html">QString</a> s = e.<a href="#text">text</a>()
|
---|
100 | </pre>
|
---|
101 |
|
---|
102 | The text() function operates recursively to find the text (since
|
---|
103 | not all elements contain text). If you want to find all the text
|
---|
104 | in all of a node's children, iterate over the children looking for
|
---|
105 | <a href="qdomtext.html">QDomText</a> nodes, e.g.
|
---|
106 | <pre>
|
---|
107 | <a href="qstring.html">QString</a> text;
|
---|
108 | QDomElement element = doc.documentElement();
|
---|
109 | for( <a href="qdomnode.html">QDomNode</a> n = element.<a href="qdomnode.html#firstChild">firstChild</a>(); !n.<a href="qdomnode.html#isNull">isNull</a>(); n = n.<a href="qdomnode.html#nextSibling">nextSibling</a>() )
|
---|
110 | {
|
---|
111 | <a href="qdomtext.html">QDomText</a> t = n.<a href="qdomnode.html#toText">toText</a>();
|
---|
112 | if ( !t.<a href="qdomnode.html#isNull">isNull</a>() )
|
---|
113 | text += t.<a href="qdomcharacterdata.html#data">data</a>();
|
---|
114 | }
|
---|
115 | </pre>
|
---|
116 |
|
---|
117 | Note that we attempt to convert each node to a text node and use
|
---|
118 | <a href="#text">text</a>() rather than using <a href="qdomnode.html#firstChild">firstChild</a>().<a href="qdomnode.html#toText">toText</a>().data() or
|
---|
119 | n.toText().data() directly on the node, because the node may not
|
---|
120 | be a text element.
|
---|
121 | <p> You can get a list of all the decendents of an element which have
|
---|
122 | a specified tag name with <a href="#elementsByTagName">elementsByTagName</a>() or
|
---|
123 | <a href="#elementsByTagNameNS">elementsByTagNameNS</a>().
|
---|
124 | <p> For further information about the Document Object Model see
|
---|
125 | <a href="http://www.w3.org/TR/REC-DOM-Level-1/">http://www.w3.org/TR/REC-DOM-Level-1/</a> and
|
---|
126 | <a href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</a>.
|
---|
127 | For a more general introduction of the DOM implementation see the
|
---|
128 | <a href="qdomdocument.html">QDomDocument</a> documentation.
|
---|
129 | <p>See also <a href="xml-tools.html">XML</a>.
|
---|
130 |
|
---|
131 | <hr><h2>Member Function Documentation</h2>
|
---|
132 | <h3 class=fn><a name="QDomElement"></a>QDomElement::QDomElement ()
|
---|
133 | </h3>
|
---|
134 | Constructs an empty element. Use the <a href="qdomdocument.html#createElement">QDomDocument::createElement</a>()
|
---|
135 | function to construct elements with content.
|
---|
136 |
|
---|
137 | <h3 class=fn><a name="QDomElement-2"></a>QDomElement::QDomElement ( const <a href="qdomelement.html">QDomElement</a> & x )
|
---|
138 | </h3>
|
---|
139 | Constructs a copy of <em>x</em>.
|
---|
140 | <p> The data of the copy is shared (shallow copy): modifying one node
|
---|
141 | will also change the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use
|
---|
142 | <a href="qdomnode.html#cloneNode">cloneNode</a>().
|
---|
143 |
|
---|
144 | <h3 class=fn><a name="~QDomElement"></a>QDomElement::~QDomElement ()
|
---|
145 | </h3>
|
---|
146 | Destroys the object and frees its resources.
|
---|
147 |
|
---|
148 | <h3 class=fn><a href="qstring.html">QString</a> <a name="attribute"></a>QDomElement::attribute ( const <a href="qstring.html">QString</a> & name, const <a href="qstring.html">QString</a> & defValue = QString::null ) const
|
---|
149 | </h3>
|
---|
150 | Returns the attribute called <em>name</em>. If the attribute does not
|
---|
151 | exist <em>defValue</em> is returned.
|
---|
152 | <p> <p>See also <a href="#setAttribute">setAttribute</a>(), <a href="#attributeNode">attributeNode</a>(), <a href="#setAttributeNode">setAttributeNode</a>(), and <a href="#attributeNS">attributeNS</a>().
|
---|
153 |
|
---|
154 | <h3 class=fn><a href="qstring.html">QString</a> <a name="attributeNS"></a>QDomElement::attributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & localName, const <a href="qstring.html">QString</a> & defValue ) const
|
---|
155 | </h3>
|
---|
156 | Returns the attribute with the local name <em>localName</em> and the
|
---|
157 | namespace URI <em>nsURI</em>. If the attribute does not exist <em>defValue</em> is returned.
|
---|
158 | <p> <p>See also <a href="#setAttributeNS">setAttributeNS</a>(), <a href="#attributeNodeNS">attributeNodeNS</a>(), <a href="#setAttributeNodeNS">setAttributeNodeNS</a>(), and <a href="#attribute">attribute</a>().
|
---|
159 |
|
---|
160 | <h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="attributeNode"></a>QDomElement::attributeNode ( const <a href="qstring.html">QString</a> & name )
|
---|
161 | </h3>
|
---|
162 | Returns the <a href="qdomattr.html">QDomAttr</a> object that corresponds to the attribute
|
---|
163 | called <em>name</em>. If no such attribute exists a <a href="qdomnode.html#isNull">null attribute</a> is returned.
|
---|
164 | <p> <p>See also <a href="#setAttributeNode">setAttributeNode</a>(), <a href="#attribute">attribute</a>(), <a href="#setAttribute">setAttribute</a>(), and <a href="#attributeNodeNS">attributeNodeNS</a>().
|
---|
165 |
|
---|
166 | <h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="attributeNodeNS"></a>QDomElement::attributeNodeNS ( const <a href="qstring.html">QString</a> & nsURI, const <a href="qstring.html">QString</a> & localName )
|
---|
167 | </h3>
|
---|
168 | Returns the <a href="qdomattr.html">QDomAttr</a> object that corresponds to the attribute with
|
---|
169 | the local name <em>localName</em> and the namespace URI <em>nsURI</em>. If no
|
---|
170 | such attribute exists a <a href="qdomnode.html#isNull">null
|
---|
171 | attribute</a> is returned.
|
---|
172 | <p> <p>See also <a href="#setAttributeNode">setAttributeNode</a>(), <a href="#attribute">attribute</a>(), and <a href="#setAttribute">setAttribute</a>().
|
---|
173 |
|
---|
174 | <h3 class=fn><a href="qdomnamednodemap.html">QDomNamedNodeMap</a> <a name="attributes"></a>QDomElement::attributes () const<tt> [virtual]</tt>
|
---|
175 | </h3>
|
---|
176 | Returns a <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> containing all this element's attributes.
|
---|
177 | <p> <p>See also <a href="#attribute">attribute</a>(), <a href="#setAttribute">setAttribute</a>(), <a href="#attributeNode">attributeNode</a>(), and <a href="#setAttributeNode">setAttributeNode</a>().
|
---|
178 |
|
---|
179 | <p>Reimplemented from <a href="qdomnode.html#attributes">QDomNode</a>.
|
---|
180 | <h3 class=fn><a href="qdomnodelist.html">QDomNodeList</a> <a name="elementsByTagName"></a>QDomElement::elementsByTagName ( const <a href="qstring.html">QString</a> & tagname ) const<tt> [virtual]</tt>
|
---|
181 | </h3>
|
---|
182 | Returns a <a href="qdomnodelist.html">QDomNodeList</a> containing all descendent elements of this
|
---|
183 | element that are called <em>tagname</em>. The order they are in the node
|
---|
184 | list is the order they are encountered in a preorder traversal of
|
---|
185 | the element tree.
|
---|
186 | <p> <p>See also <a href="#elementsByTagNameNS">elementsByTagNameNS</a>() and <a href="qdomdocument.html#elementsByTagName">QDomDocument::elementsByTagName</a>().
|
---|
187 |
|
---|
188 | <h3 class=fn><a href="qdomnodelist.html">QDomNodeList</a> <a name="elementsByTagNameNS"></a>QDomElement::elementsByTagNameNS ( const <a href="qstring.html">QString</a> & nsURI, const <a href="qstring.html">QString</a> & localName ) const<tt> [virtual]</tt>
|
---|
189 | </h3>
|
---|
190 | Returns a <a href="qdomnodelist.html">QDomNodeList</a> containing all the descendent elements of
|
---|
191 | this element with the local name <em>localName</em> and the namespace
|
---|
192 | URI <em>nsURI</em>. The order they are in the node list is the order
|
---|
193 | they are encountered in a preorder traversal of the element tree.
|
---|
194 | <p> <p>See also <a href="#elementsByTagName">elementsByTagName</a>() and <a href="qdomdocument.html#elementsByTagNameNS">QDomDocument::elementsByTagNameNS</a>().
|
---|
195 |
|
---|
196 | <h3 class=fn>bool <a name="hasAttribute"></a>QDomElement::hasAttribute ( const <a href="qstring.html">QString</a> & name ) const
|
---|
197 | </h3>
|
---|
198 | Returns TRUE if this element has an attribute called <em>name</em>;
|
---|
199 | otherwise returns FALSE.
|
---|
200 |
|
---|
201 | <h3 class=fn>bool <a name="hasAttributeNS"></a>QDomElement::hasAttributeNS ( const <a href="qstring.html">QString</a> & nsURI, const <a href="qstring.html">QString</a> & localName ) const
|
---|
202 | </h3>
|
---|
203 | Returns TRUE if this element has an attribute with the local name
|
---|
204 | <em>localName</em> and the namespace URI <em>nsURI</em>; otherwise returns
|
---|
205 | FALSE.
|
---|
206 |
|
---|
207 | <h3 class=fn>bool <a name="isElement"></a>QDomElement::isElement () const<tt> [virtual]</tt>
|
---|
208 | </h3>
|
---|
209 | Returns TRUE.
|
---|
210 |
|
---|
211 | <p>Reimplemented from <a href="qdomnode.html#isElement">QDomNode</a>.
|
---|
212 | <h3 class=fn><a href="qdomnode.html#NodeType-enum">QDomNode::NodeType</a> <a name="nodeType"></a>QDomElement::nodeType () const<tt> [virtual]</tt>
|
---|
213 | </h3>
|
---|
214 | Returns <a href="qdomnode.html#NodeType-enum">ElementNode</a>.
|
---|
215 |
|
---|
216 | <p>Reimplemented from <a href="qdomnode.html#nodeType">QDomNode</a>.
|
---|
217 | <h3 class=fn><a href="qdomelement.html">QDomElement</a> & <a name="operator-eq"></a>QDomElement::operator= ( const <a href="qdomelement.html">QDomElement</a> & x )
|
---|
218 | </h3>
|
---|
219 | Assigns <em>x</em> to this DOM element.
|
---|
220 | <p> The data of the copy is shared (shallow copy): modifying one node
|
---|
221 | will also change the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use
|
---|
222 | <a href="qdomnode.html#cloneNode">cloneNode</a>().
|
---|
223 |
|
---|
224 | <h3 class=fn>void <a name="removeAttribute"></a>QDomElement::removeAttribute ( const <a href="qstring.html">QString</a> & name )
|
---|
225 | </h3>
|
---|
226 | Removes the attribute called name <em>name</em> from this element.
|
---|
227 | <p> <p>See also <a href="#setAttribute">setAttribute</a>(), <a href="#attribute">attribute</a>(), and <a href="#removeAttributeNS">removeAttributeNS</a>().
|
---|
228 |
|
---|
229 | <h3 class=fn>void <a name="removeAttributeNS"></a>QDomElement::removeAttributeNS ( const <a href="qstring.html">QString</a> & nsURI, const <a href="qstring.html">QString</a> & localName )
|
---|
230 | </h3>
|
---|
231 | Removes the attribute with the local name <em>localName</em> and the
|
---|
232 | namespace URI <em>nsURI</em> from this element.
|
---|
233 | <p> <p>See also <a href="#setAttributeNS">setAttributeNS</a>(), <a href="#attributeNS">attributeNS</a>(), and <a href="#removeAttribute">removeAttribute</a>().
|
---|
234 |
|
---|
235 | <h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="removeAttributeNode"></a>QDomElement::removeAttributeNode ( const <a href="qdomattr.html">QDomAttr</a> & oldAttr )
|
---|
236 | </h3>
|
---|
237 | Removes the attribute <em>oldAttr</em> from the element and returns it.
|
---|
238 | <p> <p>See also <a href="#attributeNode">attributeNode</a>() and <a href="#setAttributeNode">setAttributeNode</a>().
|
---|
239 |
|
---|
240 | <h3 class=fn>void <a name="setAttribute"></a>QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & name, const <a href="qstring.html">QString</a> & value )
|
---|
241 | </h3>
|
---|
242 | Adds an attribute called <em>name</em> with value <em>value</em>. If an
|
---|
243 | attribute with the same name exists, its value is replaced by <em>value</em>.
|
---|
244 | <p> <p>See also <a href="#attribute">attribute</a>(), <a href="#setAttributeNode">setAttributeNode</a>(), and <a href="#setAttributeNS">setAttributeNS</a>().
|
---|
245 |
|
---|
246 | <h3 class=fn>void <a name="setAttribute-2"></a>QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & name, int value )
|
---|
247 | </h3>
|
---|
248 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
249 | <p>
|
---|
250 | <h3 class=fn>void <a name="setAttribute-3"></a>QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & name, uint value )
|
---|
251 | </h3>
|
---|
252 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
253 | <p>
|
---|
254 | <h3 class=fn>void <a name="setAttribute-4"></a>QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & name, long value )
|
---|
255 | </h3>
|
---|
256 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
257 | <p>
|
---|
258 | <h3 class=fn>void <a name="setAttribute-5"></a>QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & name, ulong value )
|
---|
259 | </h3>
|
---|
260 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
261 | <p>
|
---|
262 | <h3 class=fn>void <a name="setAttribute-6"></a>QDomElement::setAttribute ( const <a href="qstring.html">QString</a> & name, double value )
|
---|
263 | </h3>
|
---|
264 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
265 | <p>
|
---|
266 | <h3 class=fn>void <a name="setAttributeNS"></a>QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & qName, const <a href="qstring.html">QString</a> & value )
|
---|
267 | </h3>
|
---|
268 | Adds an attribute with the qualified name <em>qName</em> and the
|
---|
269 | namespace URI <em>nsURI</em> with the value <em>value</em>. If an attribute
|
---|
270 | with the same local name and namespace URI exists, its prefix is
|
---|
271 | replaced by the prefix of <em>qName</em> and its value is repaced by <em>value</em>.
|
---|
272 | <p> Although <em>qName</em> is the qualified name, the local name is used to
|
---|
273 | decide if an existing attribute's value should be replaced.
|
---|
274 | <p> <p>See also <a href="#attributeNS">attributeNS</a>(), <a href="#setAttributeNodeNS">setAttributeNodeNS</a>(), and <a href="#setAttribute">setAttribute</a>().
|
---|
275 |
|
---|
276 | <h3 class=fn>void <a name="setAttributeNS-2"></a>QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & qName, int value )
|
---|
277 | </h3>
|
---|
278 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
279 | <p>
|
---|
280 | <h3 class=fn>void <a name="setAttributeNS-3"></a>QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & qName, uint value )
|
---|
281 | </h3>
|
---|
282 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
283 | <p>
|
---|
284 | <h3 class=fn>void <a name="setAttributeNS-4"></a>QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & qName, long value )
|
---|
285 | </h3>
|
---|
286 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
287 | <p>
|
---|
288 | <h3 class=fn>void <a name="setAttributeNS-5"></a>QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & qName, ulong value )
|
---|
289 | </h3>
|
---|
290 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
291 | <p>
|
---|
292 | <h3 class=fn>void <a name="setAttributeNS-6"></a>QDomElement::setAttributeNS ( const <a href="qstring.html">QString</a> nsURI, const <a href="qstring.html">QString</a> & qName, double value )
|
---|
293 | </h3>
|
---|
294 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
295 | <p>
|
---|
296 | <h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="setAttributeNode"></a>QDomElement::setAttributeNode ( const <a href="qdomattr.html">QDomAttr</a> & newAttr )
|
---|
297 | </h3>
|
---|
298 | Adds the attribute <em>newAttr</em> to this element.
|
---|
299 | <p> If the element has another attribute that has the same name as <em>newAttr</em>, this function replaces that attribute and returns it;
|
---|
300 | otherwise the function returns a <a href="qdomnode.html#isNull">null
|
---|
301 | attribute</a>.
|
---|
302 | <p> <p>See also <a href="#attributeNode">attributeNode</a>(), <a href="#setAttribute">setAttribute</a>(), and <a href="#setAttributeNodeNS">setAttributeNodeNS</a>().
|
---|
303 |
|
---|
304 | <h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="setAttributeNodeNS"></a>QDomElement::setAttributeNodeNS ( const <a href="qdomattr.html">QDomAttr</a> & newAttr )
|
---|
305 | </h3>
|
---|
306 | Adds the attribute <em>newAttr</em> to this element.
|
---|
307 | <p> If the element has another attribute that has the same local name
|
---|
308 | and namespace URI as <em>newAttr</em>, this function replaces that
|
---|
309 | attribute and returns it; otherwise the function returns a <a href="qdomnode.html#isNull">null attribute</a>.
|
---|
310 | <p> <p>See also <a href="#attributeNodeNS">attributeNodeNS</a>(), <a href="#setAttributeNS">setAttributeNS</a>(), and <a href="#setAttributeNode">setAttributeNode</a>().
|
---|
311 |
|
---|
312 | <h3 class=fn>void <a name="setTagName"></a>QDomElement::setTagName ( const <a href="qstring.html">QString</a> & name )
|
---|
313 | </h3>
|
---|
314 | Sets this element's tag name to <em>name</em>.
|
---|
315 | <p> <p>See also <a href="#tagName">tagName</a>().
|
---|
316 |
|
---|
317 | <h3 class=fn><a href="qstring.html">QString</a> <a name="tagName"></a>QDomElement::tagName () const
|
---|
318 | </h3>
|
---|
319 | Returns the tag name of this element. For an XML element like this:
|
---|
320 | <pre>
|
---|
321 | <img src="myimg.png">
|
---|
322 | </pre>
|
---|
323 |
|
---|
324 | the tagname would return "img".
|
---|
325 | <p> <p>See also <a href="#setTagName">setTagName</a>().
|
---|
326 |
|
---|
327 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QDomElement::text () const
|
---|
328 | </h3>
|
---|
329 | Returns the element's text or <a href="qstring.html#QString-null">QString::null</a>.
|
---|
330 | <p> Example:
|
---|
331 | <pre>
|
---|
332 | <h1>Hello <b>Qt</b> <![CDATA[<xml is cool>]]></h1>
|
---|
333 | </pre>
|
---|
334 |
|
---|
335 | <p> The function <a href="#text">text</a>() of the QDomElement for the <h1> tag,
|
---|
336 | will return "Hello Qt <xml is cool>".
|
---|
337 | <p> Comments are ignored by this function. It only evaluates <a href="qdomtext.html">QDomText</a>
|
---|
338 | and <a href="qdomcdatasection.html">QDomCDATASection</a> objects.
|
---|
339 |
|
---|
340 | <!-- eof -->
|
---|
341 | <hr><p>
|
---|
342 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
343 | Copyright © 1995-2007
|
---|
344 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
345 | <table width=100% cellspacing=0 border=0><tr>
|
---|
346 | <td>Copyright © 2007
|
---|
347 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
348 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
349 | </table></div></address></body>
|
---|
350 | </html>
|
---|