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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QDomElement Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QDomElement Class Reference<br><small>[ <a href="xml.html">XML module</a> ]</small></h1><br clear="all">
<p>
The QDomElement class represents one element in the DOM tree.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qdom-h.html">qdom.h</a>></code>
<p>
Inherits <a href="qdomnode.html">QDomNode</a>.
<p><a href="qdomelement-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#5c5365"><b>QDomElement</b></a>()</div>
<li><div class="fn"><a href="#ef0d2f"><b>QDomElement</b></a>(constQDomElement&x)</div>
<li><div class="fn">QDomElement&<a href="#4a3983"><b>operator=</b></a>(constQDomElement&)</div>
<li><div class="fn"><a href="#0cd7d9"><b>~QDomElement</b></a>()</div>
<li><div class="fn">void<a href="#26f15c"><b>setTagName</b></a>(constQString&name)</div>
<li><div class="fn">QString<a href="#a75b61"><b>tagName</b></a>()const</div>
<li><div class="fn">QString<a href="#bbd00e"><b>attribute</b></a>(constQString&name, constQString&defValue=QString::null)const</div>
<li><div class="fn">void<a href="#137828"><b>setAttribute</b></a>(constQString&name, constQString&value)</div>
<li><div class="fn">void<a href="#1c22b3"><b>setAttribute</b></a>(constQString&name, intvalue)</div>
<li><div class="fn">void<a href="#723152"><b>setAttribute</b></a>(constQString&name, uintvalue)</div>
<li><div class="fn">void<a href="#a5008c"><b>setAttribute</b></a>(constQString&name, doublevalue)</div>
<li><div class="fn">void<a href="#dfe9bd"><b>removeAttribute</b></a>(constQString&name)</div>
<li><div class="fn">QDomAttr<a href="#547880"><b>attributeNode</b></a>(constQString&name)</div>
<li><div class="fn">QDomAttr<a href="#d62ab8"><b>setAttributeNode</b></a>(constQDomAttr&newAttr)</div>
<li><div class="fn">QDomAttr<a href="#ef8b83"><b>removeAttributeNode</b></a>(constQDomAttr&oldAttr)</div>
<li><div class="fn">bool<a href="#687420"><b>hasAttribute</b></a>(constQString&name)const</div>
<li><div class="fn">virtualQDomNodeList<a href="#0f90c8"><b>elementsByTagName</b></a>(constQString&tagname)const</div>
<li><div class="fn">void<a href="#232d73"><b>normalize</b></a>()</div>
<li><div class="fn">virtualQDomNamedNodeMap<a href="#ae6460"><b>attributes</b></a>()const</div>
<li><div class="fn">virtualQDomNode::NodeType<a href="#4114d9"><b>nodeType</b></a>()const</div>
<li><div class="fn">virtualbool<a href="#077a69"><b>isElement</b></a>()const</div>
<li><div class="fn">QString<a href="#182f96"><b>text</b></a>()const</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QDomElement class represents one element in the DOM tree.
<p>
Elements have a name() and zero or more attributes associated with them.
<p>Attributes of the element are represented by <a href="qdomattr.html">QDomAttr</a> objects, that can be
queried using the <a href="#bbd00e">attribute</a>() and <a href="#547880">attributeNode</a>() functions. You can set
attributes with the <a href="#137828">setAttribute</a>() and <a href="#d62ab8">setAttributeNode</a>() functions.
<p>For further information about the Document Objct Model see
<a href="http://www.w3.org/TR/REC-DOM-Level-1/">http://www.w3.org/TR/REC-DOM-Level-1/</a>.
For a more general introduction of the DOM implementation see the
<a href="qdomdocument.html">QDomDocument</a> documentation.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="5c5365"></a>QDomElement::QDomElement()</h3>
<p>Constructs an empty element. Use the <a href="qdomdocument.html#019a5f">QDomDocument::createElement</a>() function
to construct elements with content.
<h3 class="fn"><a name="ef0d2f"></a>QDomElement::QDomElement(constQDomElement&x)</h3>
<p>Copy constructor.
<p>The data of the copy is shared: modifying one will also change the other. If
you want to make a real copy, use <a href="qdomnode.html#7b27fa">cloneNode</a>() instead.
<h3 class="fn"><a name="0cd7d9"></a>QDomElement::~QDomElement()</h3>
<p>Destructor.
<h3 class="fn"><a href="qstring.html">QString</a><a name="bbd00e"></a>QDomElement::attribute(const<a href="qstring.html">QString</a>&name, const<a href="qstring.html">QString</a>&defValue=QString::null)const</h3>
<p>Returns the attribute with the name <em>name.</em> If the attribute does not exist
<em>defValue</em> is returned.
<p>See also <a href="#137828">setAttribute</a>(), <a href="#547880">attributeNode</a>() and <a href="#d62ab8">setAttributeNode</a>().
<h3 class="fn"><a href="qdomattr.html">QDomAttr</a><a name="547880"></a>QDomElement::attributeNode(const<a href="qstring.html">QString</a>&name)</h3>
<p>Returns the <a href="qdomattr.html">QDomAttr</a> object that corresponds to the attribute with the name
<em>name.</em> If no such attribute exists a null object is returned.
<p>See also <a href="#d62ab8">setAttributeNode</a>(), <a href="#bbd00e">attribute</a>() and <a href="#137828">setAttribute</a>().
<h3 class="fn"><a href="qdomnamednodemap.html">QDomNamedNodeMap</a><a name="ae6460"></a>QDomElement::attributes()const <code>[virtual]</code></h3>
<p>Returns a <a href="qdomnamednodemap.html">QDomNamedNodeMap</a> containing all attributes for this element.
<p>See also <a href="#bbd00e">attribute</a>(), <a href="#137828">setAttribute</a>(), <a href="#547880">attributeNode</a>() and <a href="#d62ab8">setAttributeNode</a>().
<p>Reimplemented from <a href="qdomnode.html#b801ac">QDomNode.</a>
<h3 class="fn"><a href="qdomnodelist.html">QDomNodeList</a><a name="0f90c8"></a>QDomElement::elementsByTagName(const<a href="qstring.html">QString</a>&tagname)const <code>[virtual]</code></h3>
<p>Returns a <a href="qdomnodelist.html">QDomNodeList</a> containing all descendant elements of this element
with the name <em>tagname.</em> The order they are in the node list, is the order
they are encountered in a preorder traversal of the element tree.
<h3 class="fn">bool<a name="687420"></a>QDomElement::hasAttribute(const<a href="qstring.html">QString</a>&name)const</h3>
<p>Returns TRUE is this element has an attribute with the name <em>name,</em>
otherwise FALSE.
<h3 class="fn">bool<a name="077a69"></a>QDomElement::isElement()const <code>[virtual]</code></h3>
<p>Returns TRUE.
<p>Reimplemented from <a href="qdomnode.html#c31d27">QDomNode.</a>
<h3 class="fn">QDomNode::NodeType<a name="4114d9"></a>QDomElement::nodeType()const <code>[virtual]</code></h3>
<p>Returns <code>ElementNode.</code>
<p>Reimplemented from <a href="qdomnode.html#4aab85">QDomNode.</a>
<h3 class="fn">void<a name="232d73"></a>QDomElement::normalize()</h3>
<p>Calling normalize() on an element brings all its children into a standard
form. This means, that adjacent <a href="qdomtext.html">QDomText</a> objects will be merged to
one text object (<a href="qdomcdatasection.html">QDomCDATASection</a> nodes are not merged).
<h3 class="fn">QDomElement&<a name="4a3983"></a>QDomElement::operator=(constQDomElement&x)</h3>
<p>Assignment operator.
<p>The data of the copy is shared: modifying one will also change the other. If
you want to make a real copy, use <a href="qdomnode.html#7b27fa">cloneNode</a>() instead.
<h3 class="fn">void<a name="dfe9bd"></a>QDomElement::removeAttribute(const<a href="qstring.html">QString</a>&name)</h3>
<p>Removes the attribute with the name <em>name</em> from this element.
<p>See also <a href="#137828">setAttribute</a>() and <a href="#bbd00e">attribute</a>().
<h3 class="fn"><a href="qdomattr.html">QDomAttr</a><a name="ef8b83"></a>QDomElement::removeAttributeNode(const<a href="qdomattr.html">QDomAttr</a>&oldAttr)</h3>
<p>Removes the attribute <em>oldAttr</em> from the element and returns it.
<p>See also <a href="#547880">attributeNode</a>() and <a href="#d62ab8">setAttributeNode</a>().
<h3 class="fn">void<a name="137828"></a>QDomElement::setAttribute(const<a href="qstring.html">QString</a>&name, const<a href="qstring.html">QString</a>&value)</h3>
<p>Sets the attribute with the name <em>name</em> to the string <em>value.</em> If the
attribute does not exist, a new one is created.
<h3 class="fn">void<a name="a5008c"></a>QDomElement::setAttribute(const<a href="qstring.html">QString</a>&name, doublevalue)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="1c22b3"></a>QDomElement::setAttribute(const<a href="qstring.html">QString</a>&name, intvalue)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="723152"></a>QDomElement::setAttribute(const<a href="qstring.html">QString</a>&name, uintvalue)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn"><a href="qdomattr.html">QDomAttr</a><a name="d62ab8"></a>QDomElement::setAttributeNode(const<a href="qdomattr.html">QDomAttr</a>&newAttr)</h3>
<p>Adds the attribute <em>newAttr</em> to this element.
<p>If an attribute with the name <em>newAttr</em> exists in the element, the function
returns this attribute; otherwise the function returns a null attribute.
<p>See also <a href="#547880">attributeNode</a>().
<h3 class="fn">void<a name="26f15c"></a>QDomElement::setTagName(const<a href="qstring.html">QString</a>&name)</h3>
<p>Sets the tag name of this element.
<p>See also <a href="#a75b61">tagName</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="a75b61"></a>QDomElement::tagName()const</h3>
<p>Returns the tag name of this element. For an XML element like
<pre> <img src="myimg.png">
</pre>
<p>the tagname would return "img".
<p>See also <a href="#26f15c">setTagName</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="182f96"></a>QDomElement::text()const</h3>
<p>Returns the text contained inside this element.
<p>Example:
<pre> <h1>Hello <b><a href="qt.html">Qt</a></b> <![CDATA[<xml is cool>]]></h1>
</pre>
<p>The function text() of the QDomElement for the <h1> tag,
will return "Hello Qt <xml is cool>".
<p>Comments are ignored by this function. It evaluates only
<a href="qdomtext.html">QDomText</a> and <a href="qdomcdatasection.html">QDomCDATASection</a> objects.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.1"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2000
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2000 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.1</div>
</table></div></address></body></html>
|