[190] | 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:1528 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QDomNode 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>QDomNode Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QDomNode class is the base class for all the nodes in a 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>Inherited by <a href="qdomdocumenttype.html">QDomDocumentType</a>, <a href="qdomdocument.html">QDomDocument</a>, <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>, <a href="qdomcharacterdata.html">QDomCharacterData</a>, <a href="qdomattr.html">QDomAttr</a>, <a href="qdomelement.html">QDomElement</a>, <a href="qdomnotation.html">QDomNotation</a>, <a href="qdomentity.html">QDomEntity</a>, <a href="qdomentityreference.html">QDomEntityReference</a>, and <a href="qdomprocessinginstruction.html">QDomProcessingInstruction</a>.
|
---|
| 39 | <p><a href="qdomnode-members.html">List of all member functions.</a>
|
---|
| 40 | <h2>Public Members</h2>
|
---|
| 41 | <ul>
|
---|
| 42 | <li class=fn>enum <a href="#NodeType-enum"><b>NodeType</b></a> { ElementNode = 1, AttributeNode = 2, TextNode = 3, CDATASectionNode = 4, EntityReferenceNode = 5, EntityNode = 6, ProcessingInstructionNode = 7, CommentNode = 8, DocumentNode = 9, DocumentTypeNode = 10, DocumentFragmentNode = 11, NotationNode = 12, BaseNode = 21, CharacterDataNode = 22 }</li>
|
---|
| 43 | <li class=fn><a href="#QDomNode"><b>QDomNode</b></a> ()</li>
|
---|
| 44 | <li class=fn><a href="#QDomNode-2"><b>QDomNode</b></a> ( const QDomNode & n )</li>
|
---|
| 45 | <li class=fn>QDomNode & <a href="#operator-eq"><b>operator=</b></a> ( const QDomNode & n )</li>
|
---|
| 46 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QDomNode & n ) const</li>
|
---|
| 47 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QDomNode & n ) const</li>
|
---|
| 48 | <li class=fn>virtual <a href="#~QDomNode"><b>~QDomNode</b></a> ()</li>
|
---|
| 49 | <li class=fn>virtual QDomNode <a href="#insertBefore"><b>insertBefore</b></a> ( const QDomNode & newChild, const QDomNode & refChild )</li>
|
---|
| 50 | <li class=fn>virtual QDomNode <a href="#insertAfter"><b>insertAfter</b></a> ( const QDomNode & newChild, const QDomNode & refChild )</li>
|
---|
| 51 | <li class=fn>virtual QDomNode <a href="#replaceChild"><b>replaceChild</b></a> ( const QDomNode & newChild, const QDomNode & oldChild )</li>
|
---|
| 52 | <li class=fn>virtual QDomNode <a href="#removeChild"><b>removeChild</b></a> ( const QDomNode & oldChild )</li>
|
---|
| 53 | <li class=fn>virtual QDomNode <a href="#appendChild"><b>appendChild</b></a> ( const QDomNode & newChild )</li>
|
---|
| 54 | <li class=fn>virtual bool <a href="#hasChildNodes"><b>hasChildNodes</b></a> () const</li>
|
---|
| 55 | <li class=fn>virtual QDomNode <a href="#cloneNode"><b>cloneNode</b></a> ( bool deep = TRUE ) const</li>
|
---|
| 56 | <li class=fn>virtual void <a href="#normalize"><b>normalize</b></a> ()</li>
|
---|
| 57 | <li class=fn>virtual bool <a href="#isSupported"><b>isSupported</b></a> ( const QString & feature, const QString & version ) const</li>
|
---|
| 58 | <li class=fn>virtual QString <a href="#nodeName"><b>nodeName</b></a> () const</li>
|
---|
| 59 | <li class=fn>virtual QDomNode::NodeType <a href="#nodeType"><b>nodeType</b></a> () const</li>
|
---|
| 60 | <li class=fn>virtual QDomNode <a href="#parentNode"><b>parentNode</b></a> () const</li>
|
---|
| 61 | <li class=fn>virtual QDomNodeList <a href="#childNodes"><b>childNodes</b></a> () const</li>
|
---|
| 62 | <li class=fn>virtual QDomNode <a href="#firstChild"><b>firstChild</b></a> () const</li>
|
---|
| 63 | <li class=fn>virtual QDomNode <a href="#lastChild"><b>lastChild</b></a> () const</li>
|
---|
| 64 | <li class=fn>virtual QDomNode <a href="#previousSibling"><b>previousSibling</b></a> () const</li>
|
---|
| 65 | <li class=fn>virtual QDomNode <a href="#nextSibling"><b>nextSibling</b></a> () const</li>
|
---|
| 66 | <li class=fn>virtual QDomNamedNodeMap <a href="#attributes"><b>attributes</b></a> () const</li>
|
---|
| 67 | <li class=fn>virtual QDomDocument <a href="#ownerDocument"><b>ownerDocument</b></a> () const</li>
|
---|
| 68 | <li class=fn>virtual QString <a href="#namespaceURI"><b>namespaceURI</b></a> () const</li>
|
---|
| 69 | <li class=fn>virtual QString <a href="#localName"><b>localName</b></a> () const</li>
|
---|
| 70 | <li class=fn>virtual bool <a href="#hasAttributes"><b>hasAttributes</b></a> () const</li>
|
---|
| 71 | <li class=fn>virtual QString <a href="#nodeValue"><b>nodeValue</b></a> () const</li>
|
---|
| 72 | <li class=fn>virtual void <a href="#setNodeValue"><b>setNodeValue</b></a> ( const QString & v )</li>
|
---|
| 73 | <li class=fn>virtual QString <a href="#prefix"><b>prefix</b></a> () const</li>
|
---|
| 74 | <li class=fn>virtual void <a href="#setPrefix"><b>setPrefix</b></a> ( const QString & pre )</li>
|
---|
| 75 | <li class=fn>virtual bool <a href="#isAttr"><b>isAttr</b></a> () const</li>
|
---|
| 76 | <li class=fn>virtual bool <a href="#isCDATASection"><b>isCDATASection</b></a> () const</li>
|
---|
| 77 | <li class=fn>virtual bool <a href="#isDocumentFragment"><b>isDocumentFragment</b></a> () const</li>
|
---|
| 78 | <li class=fn>virtual bool <a href="#isDocument"><b>isDocument</b></a> () const</li>
|
---|
| 79 | <li class=fn>virtual bool <a href="#isDocumentType"><b>isDocumentType</b></a> () const</li>
|
---|
| 80 | <li class=fn>virtual bool <a href="#isElement"><b>isElement</b></a> () const</li>
|
---|
| 81 | <li class=fn>virtual bool <a href="#isEntityReference"><b>isEntityReference</b></a> () const</li>
|
---|
| 82 | <li class=fn>virtual bool <a href="#isText"><b>isText</b></a> () const</li>
|
---|
| 83 | <li class=fn>virtual bool <a href="#isEntity"><b>isEntity</b></a> () const</li>
|
---|
| 84 | <li class=fn>virtual bool <a href="#isNotation"><b>isNotation</b></a> () const</li>
|
---|
| 85 | <li class=fn>virtual bool <a href="#isProcessingInstruction"><b>isProcessingInstruction</b></a> () const</li>
|
---|
| 86 | <li class=fn>virtual bool <a href="#isCharacterData"><b>isCharacterData</b></a> () const</li>
|
---|
| 87 | <li class=fn>virtual bool <a href="#isComment"><b>isComment</b></a> () const</li>
|
---|
| 88 | <li class=fn>QDomNode <a href="#namedItem"><b>namedItem</b></a> ( const QString & name ) const</li>
|
---|
| 89 | <li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
---|
| 90 | <li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
|
---|
| 91 | <li class=fn>QDomAttr <a href="#toAttr"><b>toAttr</b></a> ()</li>
|
---|
| 92 | <li class=fn>QDomCDATASection <a href="#toCDATASection"><b>toCDATASection</b></a> ()</li>
|
---|
| 93 | <li class=fn>QDomDocumentFragment <a href="#toDocumentFragment"><b>toDocumentFragment</b></a> ()</li>
|
---|
| 94 | <li class=fn>QDomDocument <a href="#toDocument"><b>toDocument</b></a> ()</li>
|
---|
| 95 | <li class=fn>QDomDocumentType <a href="#toDocumentType"><b>toDocumentType</b></a> ()</li>
|
---|
| 96 | <li class=fn>QDomElement <a href="#toElement"><b>toElement</b></a> ()</li>
|
---|
| 97 | <li class=fn>QDomEntityReference <a href="#toEntityReference"><b>toEntityReference</b></a> ()</li>
|
---|
| 98 | <li class=fn>QDomText <a href="#toText"><b>toText</b></a> ()</li>
|
---|
| 99 | <li class=fn>QDomEntity <a href="#toEntity"><b>toEntity</b></a> ()</li>
|
---|
| 100 | <li class=fn>QDomNotation <a href="#toNotation"><b>toNotation</b></a> ()</li>
|
---|
| 101 | <li class=fn>QDomProcessingInstruction <a href="#toProcessingInstruction"><b>toProcessingInstruction</b></a> ()</li>
|
---|
| 102 | <li class=fn>QDomCharacterData <a href="#toCharacterData"><b>toCharacterData</b></a> ()</li>
|
---|
| 103 | <li class=fn>QDomComment <a href="#toComment"><b>toComment</b></a> ()</li>
|
---|
| 104 | <li class=fn>void <a href="#save"><b>save</b></a> ( QTextStream & str, int indent ) const</li>
|
---|
| 105 | </ul>
|
---|
| 106 | <h2>Related Functions</h2>
|
---|
| 107 | <ul>
|
---|
| 108 | <li class=fn>QTextStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QTextStream & str, const QDomNode & node )</li>
|
---|
| 109 | </ul>
|
---|
| 110 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 | The QDomNode class is the base class for all the nodes in a DOM tree.
|
---|
| 115 |
|
---|
| 116 | <p>
|
---|
| 117 |
|
---|
| 118 | <p> Many functions in the DOM return a QDomNode.
|
---|
| 119 | <p> You can find out the type of a node using <a href="#isAttr">isAttr</a>(),
|
---|
| 120 | <a href="#isCDATASection">isCDATASection</a>(), <a href="#isDocumentFragment">isDocumentFragment</a>(), <a href="#isDocument">isDocument</a>(),
|
---|
| 121 | <a href="#isDocumentType">isDocumentType</a>(), <a href="#isElement">isElement</a>(), <a href="#isEntityReference">isEntityReference</a>(), <a href="#isText">isText</a>(),
|
---|
| 122 | <a href="#isEntity">isEntity</a>(), <a href="#isNotation">isNotation</a>(), <a href="#isProcessingInstruction">isProcessingInstruction</a>(),
|
---|
| 123 | <a href="#isCharacterData">isCharacterData</a>() and <a href="#isComment">isComment</a>().
|
---|
| 124 | <p> A QDomNode can be converted into one of its subclasses using
|
---|
| 125 | <a href="#toAttr">toAttr</a>(), <a href="#toCDATASection">toCDATASection</a>(), <a href="#toDocumentFragment">toDocumentFragment</a>(), <a href="#toDocument">toDocument</a>(),
|
---|
| 126 | <a href="#toDocumentType">toDocumentType</a>(), <a href="#toElement">toElement</a>(), <a href="#toEntityReference">toEntityReference</a>(), <a href="#toText">toText</a>(),
|
---|
| 127 | <a href="#toEntity">toEntity</a>(), <a href="#toNotation">toNotation</a>(), <a href="#toProcessingInstruction">toProcessingInstruction</a>(),
|
---|
| 128 | <a href="#toCharacterData">toCharacterData</a>() or <a href="#toComment">toComment</a>(). You can convert a node to a null
|
---|
| 129 | node with <a href="#clear">clear</a>().
|
---|
| 130 | <p> Copies of the QDomNode class share their data using <a href="shclass.html#explicit-sharing">explicit sharing</a>. This means that modifying one node will change all
|
---|
| 131 | copies. This is especially useful in combination with functions
|
---|
| 132 | which return a QDomNode, e.g. <a href="#firstChild">firstChild</a>(). You can make an
|
---|
| 133 | independent (deep) copy of the node with <a href="#cloneNode">cloneNode</a>().
|
---|
| 134 | <p> Nodes are inserted with <a href="#insertBefore">insertBefore</a>(), <a href="#insertAfter">insertAfter</a>() or
|
---|
| 135 | <a href="#appendChild">appendChild</a>(). You can replace one node with another using
|
---|
| 136 | <a href="#replaceChild">replaceChild</a>() and remove a node with <a href="#removeChild">removeChild</a>().
|
---|
| 137 | <p> To traverse nodes use firstChild() to get a node's first child (if
|
---|
| 138 | any), and <a href="#nextSibling">nextSibling</a>() to traverse. QDomNode also provides
|
---|
| 139 | <a href="#lastChild">lastChild</a>(), <a href="#previousSibling">previousSibling</a>() and <a href="#parentNode">parentNode</a>(). To find the first
|
---|
| 140 | child node with a particular node name use <a href="#namedItem">namedItem</a>().
|
---|
| 141 | <p> To find out if a node has children use <a href="#hasChildNodes">hasChildNodes</a>() and to get
|
---|
| 142 | a list of all of a node's children use <a href="#childNodes">childNodes</a>().
|
---|
| 143 | <p> The node's name and value (the meaning of which varies depending
|
---|
| 144 | on its type) is returned by <a href="#nodeName">nodeName</a>() and <a href="#nodeValue">nodeValue</a>()
|
---|
| 145 | respectively. The node's type is returned by <a href="#nodeType">nodeType</a>(). The
|
---|
| 146 | node's value can be set with <a href="#setNodeValue">setNodeValue</a>().
|
---|
| 147 | <p> The document to which the node belongs is returned by
|
---|
| 148 | <a href="#ownerDocument">ownerDocument</a>().
|
---|
| 149 | <p> Adjacent <a href="qdomtext.html">QDomText</a> nodes can be merged into a single node with
|
---|
| 150 | <a href="#normalize">normalize</a>().
|
---|
| 151 | <p> <a href="qdomelement.html">QDomElement</a> nodes have attributes which can be retrieved with
|
---|
| 152 | <a href="#attributes">attributes</a>().
|
---|
| 153 | <p> <a href="qdomelement.html">QDomElement</a> and <a href="qdomattr.html">QDomAttr</a> nodes can have namespaces which can be
|
---|
| 154 | retrieved with <a href="#namespaceURI">namespaceURI</a>(). Their local name is retrieved with
|
---|
| 155 | <a href="#localName">localName</a>(), and their prefix with <a href="#prefix">prefix</a>(). The prefix can be set
|
---|
| 156 | with <a href="#setPrefix">setPrefix</a>().
|
---|
| 157 | <p> You can write the XML representation of the node to a text stream
|
---|
| 158 | with <a href="#save">save</a>().
|
---|
| 159 | <p> The following example looks for the first element in an XML document and
|
---|
| 160 | prints the names of all the elements that are its direct children.
|
---|
| 161 | <pre>
|
---|
| 162 | <a href="qdomdocument.html">QDomDocument</a> d;
|
---|
| 163 | d.<a href="qdomdocument.html#setContent">setContent</a>( someXML );
|
---|
| 164 | QDomNode n = d.<a href="#firstChild">firstChild</a>();
|
---|
| 165 | while ( !n.<a href="#isNull">isNull</a>() ) {
|
---|
| 166 | if ( n.<a href="#isElement">isElement</a>() ) {
|
---|
| 167 | <a href="qdomelement.html">QDomElement</a> e = n.<a href="#toElement">toElement</a>();
|
---|
| 168 | cout << "Element name: " << e.<a href="qdomelement.html#tagName">tagName</a>() << endl;
|
---|
| 169 | break;
|
---|
| 170 | }
|
---|
| 171 | n = n.<a href="#nextSibling">nextSibling</a>();
|
---|
| 172 | }
|
---|
| 173 | </pre>
|
---|
| 174 |
|
---|
| 175 | <p> For further information about the Document Object Model see <a href="http://www.w3.org/TR/REC-DOM-Level-1/">http://www.w3.org/TR/REC-DOM-Level-1/</a> and <a href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</a>. For a more general
|
---|
| 176 | introduction of the DOM implementation see the <a href="qdomdocument.html">QDomDocument</a>
|
---|
| 177 | documentation.
|
---|
| 178 | <p>See also <a href="xml-tools.html">XML</a>.
|
---|
| 179 |
|
---|
| 180 | <hr><h2>Member Type Documentation</h2>
|
---|
| 181 | <h3 class=fn><a name="NodeType-enum"></a>QDomNode::NodeType</h3>
|
---|
| 182 |
|
---|
| 183 | <p> This enum defines the type of the node:
|
---|
| 184 | <ul>
|
---|
| 185 | <li><tt>QDomNode::ElementNode</tt>
|
---|
| 186 | <li><tt>QDomNode::AttributeNode</tt>
|
---|
| 187 | <li><tt>QDomNode::TextNode</tt>
|
---|
| 188 | <li><tt>QDomNode::CDATASectionNode</tt>
|
---|
| 189 | <li><tt>QDomNode::EntityReferenceNode</tt>
|
---|
| 190 | <li><tt>QDomNode::EntityNode</tt>
|
---|
| 191 | <li><tt>QDomNode::ProcessingInstructionNode</tt>
|
---|
| 192 | <li><tt>QDomNode::CommentNode</tt>
|
---|
| 193 | <li><tt>QDomNode::DocumentNode</tt>
|
---|
| 194 | <li><tt>QDomNode::DocumentTypeNode</tt>
|
---|
| 195 | <li><tt>QDomNode::DocumentFragmentNode</tt>
|
---|
| 196 | <li><tt>QDomNode::NotationNode</tt>
|
---|
| 197 | <li><tt>QDomNode::BaseNode</tt> - A QDomNode object, i.e. not a QDomNode subclass.
|
---|
| 198 | <li><tt>QDomNode::CharacterDataNode</tt>
|
---|
| 199 | </ul>
|
---|
| 200 | <hr><h2>Member Function Documentation</h2>
|
---|
| 201 | <h3 class=fn><a name="QDomNode"></a>QDomNode::QDomNode ()
|
---|
| 202 | </h3>
|
---|
| 203 | Constructs a <a href="#isNull">null</a> node.
|
---|
| 204 |
|
---|
| 205 | <h3 class=fn><a name="QDomNode-2"></a>QDomNode::QDomNode ( const <a href="qdomnode.html">QDomNode</a> & n )
|
---|
| 206 | </h3>
|
---|
| 207 | Constructs a copy of <em>n</em>.
|
---|
| 208 | <p> The data of the copy is shared (shallow copy): modifying one node
|
---|
| 209 | will also change the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use
|
---|
| 210 | <a href="#cloneNode">cloneNode</a>().
|
---|
| 211 |
|
---|
| 212 | <h3 class=fn><a name="~QDomNode"></a>QDomNode::~QDomNode ()<tt> [virtual]</tt>
|
---|
| 213 | </h3>
|
---|
| 214 | Destroys the object and frees its resources.
|
---|
| 215 |
|
---|
| 216 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="appendChild"></a>QDomNode::appendChild ( const <a href="qdomnode.html">QDomNode</a> & newChild )<tt> [virtual]</tt>
|
---|
| 217 | </h3>
|
---|
| 218 | Appends <em>newChild</em> as the node's last child.
|
---|
| 219 | <p> If <em>newChild</em> is the child of another node, it is reparented to
|
---|
| 220 | this node. If <em>newChild</em> is a child of this node, then its
|
---|
| 221 | position in the list of children is changed.
|
---|
| 222 | <p> If <em>newChild</em> is a <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>, then the children of the
|
---|
| 223 | fragment are removed from the fragment and appended.
|
---|
| 224 | <p> Returns a new reference to <em>newChild</em>.
|
---|
| 225 | <p> <p>See also <a href="#insertBefore">insertBefore</a>(), <a href="#insertAfter">insertAfter</a>(), <a href="#replaceChild">replaceChild</a>(), and <a href="#removeChild">removeChild</a>().
|
---|
| 226 |
|
---|
| 227 | <h3 class=fn><a href="qdomnamednodemap.html">QDomNamedNodeMap</a> <a name="attributes"></a>QDomNode::attributes () const<tt> [virtual]</tt>
|
---|
| 228 | </h3>
|
---|
| 229 | Returns a named node map of all attributes. Attributes are only
|
---|
| 230 | provided for <a href="qdomelement.html">QDomElement</a>s.
|
---|
| 231 | <p> Changing the attributes in the map will also change the attributes
|
---|
| 232 | of this QDomNode.
|
---|
| 233 |
|
---|
| 234 | <p>Reimplemented in <a href="qdomelement.html#attributes">QDomElement</a>.
|
---|
| 235 | <h3 class=fn><a href="qdomnodelist.html">QDomNodeList</a> <a name="childNodes"></a>QDomNode::childNodes () const<tt> [virtual]</tt>
|
---|
| 236 | </h3>
|
---|
| 237 | Returns a list of all direct child nodes.
|
---|
| 238 | <p> Most often you will call this function on a <a href="qdomelement.html">QDomElement</a> object.
|
---|
| 239 | <p> For example, if the XML document looks like this:
|
---|
| 240 | <pre>
|
---|
| 241 | <body>
|
---|
| 242 | <h1>Heading</h1>
|
---|
| 243 | <p>Hello <b>you</b></p>
|
---|
| 244 | </body>
|
---|
| 245 | </pre>
|
---|
| 246 |
|
---|
| 247 | Then the list of child nodes for the "body"-element will contain
|
---|
| 248 | the node created by the <h1> tag and the node created by the
|
---|
| 249 | <p> tag.
|
---|
| 250 | <p> The nodes in the list are not copied; so changing the nodes in the
|
---|
| 251 | list will also change the children of this node.
|
---|
| 252 | <p> <p>See also <a href="#firstChild">firstChild</a>() and <a href="#lastChild">lastChild</a>().
|
---|
| 253 |
|
---|
| 254 | <h3 class=fn>void <a name="clear"></a>QDomNode::clear ()
|
---|
| 255 | </h3>
|
---|
| 256 | Converts the node into a null node; if it was not a null node
|
---|
| 257 | before, its type and contents are deleted.
|
---|
| 258 | <p> <p>See also <a href="#isNull">isNull</a>().
|
---|
| 259 |
|
---|
| 260 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="cloneNode"></a>QDomNode::cloneNode ( bool deep = TRUE ) const<tt> [virtual]</tt>
|
---|
| 261 | </h3>
|
---|
| 262 | Creates a deep (not shallow) copy of the QDomNode.
|
---|
| 263 | <p> If <em>deep</em> is TRUE, then the cloning is done recursively which
|
---|
| 264 | means that all the node's children are deep copied too. If <em>deep</em>
|
---|
| 265 | is FALSE only the node itself is copied and the copy will have no
|
---|
| 266 | child nodes.
|
---|
| 267 |
|
---|
| 268 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="firstChild"></a>QDomNode::firstChild () const<tt> [virtual]</tt>
|
---|
| 269 | </h3>
|
---|
| 270 | Returns the first child of the node. If there is no child node, a
|
---|
| 271 | <a href="#isNull">null node</a> is returned. Changing the
|
---|
| 272 | returned node will also change the node in the document tree.
|
---|
| 273 | <p> <p>See also <a href="#lastChild">lastChild</a>() and <a href="#childNodes">childNodes</a>().
|
---|
| 274 |
|
---|
| 275 | <p>Example: <a href="outliner-example.html#x1907">xml/outliner/outlinetree.cpp</a>.
|
---|
| 276 | <h3 class=fn>bool <a name="hasAttributes"></a>QDomNode::hasAttributes () const<tt> [virtual]</tt>
|
---|
| 277 | </h3>
|
---|
| 278 | Returns TRUE if the node has attributes; otherwise returns FALSE.
|
---|
| 279 | <p> <p>See also <a href="#attributes">attributes</a>().
|
---|
| 280 |
|
---|
| 281 | <h3 class=fn>bool <a name="hasChildNodes"></a>QDomNode::hasChildNodes () const<tt> [virtual]</tt>
|
---|
| 282 | </h3>
|
---|
| 283 | Returns TRUE if the node has one or more children; otherwise
|
---|
| 284 | returns FALSE.
|
---|
| 285 |
|
---|
| 286 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="insertAfter"></a>QDomNode::insertAfter ( const <a href="qdomnode.html">QDomNode</a> & newChild, const <a href="qdomnode.html">QDomNode</a> & refChild )<tt> [virtual]</tt>
|
---|
| 287 | </h3>
|
---|
| 288 | Inserts the node <em>newChild</em> after the child node <em>refChild</em>. <em>refChild</em> must be a direct child of this node. If <em>refChild</em> is
|
---|
| 289 | <a href="#isNull">null</a> then <em>newChild</em> is appended as this
|
---|
| 290 | node's last child.
|
---|
| 291 | <p> If <em>newChild</em> is the child of another node, it is reparented to
|
---|
| 292 | this node. If <em>newChild</em> is a child of this node, then its
|
---|
| 293 | position in the list of children is changed.
|
---|
| 294 | <p> If <em>newChild</em> is a <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>, then the children of the
|
---|
| 295 | fragment are removed from the fragment and inserted after <em>refChild</em>.
|
---|
| 296 | <p> Returns a new reference to <em>newChild</em> on success or a <a href="#isNull">null node</a> on failure.
|
---|
| 297 | <p> <p>See also <a href="#insertBefore">insertBefore</a>(), <a href="#replaceChild">replaceChild</a>(), <a href="#removeChild">removeChild</a>(), and <a href="#appendChild">appendChild</a>().
|
---|
| 298 |
|
---|
| 299 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="insertBefore"></a>QDomNode::insertBefore ( const <a href="qdomnode.html">QDomNode</a> & newChild, const <a href="qdomnode.html">QDomNode</a> & refChild )<tt> [virtual]</tt>
|
---|
| 300 | </h3>
|
---|
| 301 | Inserts the node <em>newChild</em> before the child node <em>refChild</em>.
|
---|
| 302 | <em>refChild</em> must be a direct child of this node. If <em>refChild</em> is
|
---|
| 303 | <a href="#isNull">null</a> then <em>newChild</em> is inserted as the
|
---|
| 304 | node's first child.
|
---|
| 305 | <p> If <em>newChild</em> is the child of another node, it is reparented to
|
---|
| 306 | this node. If <em>newChild</em> is a child of this node, then its
|
---|
| 307 | position in the list of children is changed.
|
---|
| 308 | <p> If <em>newChild</em> is a <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>, then the children of the
|
---|
| 309 | fragment are removed from the fragment and inserted before <em>refChild</em>.
|
---|
| 310 | <p> Returns a new reference to <em>newChild</em> on success or a <a href="#isNull">null node</a> on failure.
|
---|
| 311 | <p> <p>See also <a href="#insertAfter">insertAfter</a>(), <a href="#replaceChild">replaceChild</a>(), <a href="#removeChild">removeChild</a>(), and <a href="#appendChild">appendChild</a>().
|
---|
| 312 |
|
---|
| 313 | <h3 class=fn>bool <a name="isAttr"></a>QDomNode::isAttr () const<tt> [virtual]</tt>
|
---|
| 314 | </h3>
|
---|
| 315 | Returns TRUE if the node is an attribute; otherwise returns FALSE.
|
---|
| 316 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 317 | is a QDomAttribute; you can get the QDomAttribute with
|
---|
| 318 | toAttribute().
|
---|
| 319 | <p> <p>See also <a href="#toAttr">toAttr</a>().
|
---|
| 320 |
|
---|
| 321 | <p>Reimplemented in <a href="qdomattr.html#isAttr">QDomAttr</a>.
|
---|
| 322 | <h3 class=fn>bool <a name="isCDATASection"></a>QDomNode::isCDATASection () const<tt> [virtual]</tt>
|
---|
| 323 | </h3>
|
---|
| 324 | Returns TRUE if the node is a CDATA section; otherwise returns
|
---|
| 325 | FALSE.
|
---|
| 326 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 327 | is a <a href="qdomcdatasection.html">QDomCDATASection</a>; you can get the QDomCDATASection with
|
---|
| 328 | <a href="#toCDATASection">toCDATASection</a>().
|
---|
| 329 | <p> <p>See also <a href="#toCDATASection">toCDATASection</a>().
|
---|
| 330 |
|
---|
| 331 | <p>Reimplemented in <a href="qdomcdatasection.html#isCDATASection">QDomCDATASection</a>.
|
---|
| 332 | <h3 class=fn>bool <a name="isCharacterData"></a>QDomNode::isCharacterData () const<tt> [virtual]</tt>
|
---|
| 333 | </h3>
|
---|
| 334 | Returns TRUE if the node is a character data node; otherwise
|
---|
| 335 | returns FALSE.
|
---|
| 336 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 337 | is a <a href="qdomcharacterdata.html">QDomCharacterData</a>; you can get the QDomCharacterData with
|
---|
| 338 | <a href="#toCharacterData">toCharacterData</a>().
|
---|
| 339 | <p> <p>See also <a href="#toCharacterData">toCharacterData</a>().
|
---|
| 340 |
|
---|
| 341 | <p>Reimplemented in <a href="qdomcharacterdata.html#isCharacterData">QDomCharacterData</a>.
|
---|
| 342 | <h3 class=fn>bool <a name="isComment"></a>QDomNode::isComment () const<tt> [virtual]</tt>
|
---|
| 343 | </h3>
|
---|
| 344 | Returns TRUE if the node is a comment; otherwise returns FALSE.
|
---|
| 345 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 346 | is a <a href="qdomcomment.html">QDomComment</a>; you can get the QDomComment with <a href="#toComment">toComment</a>().
|
---|
| 347 | <p> <p>See also <a href="#toComment">toComment</a>().
|
---|
| 348 |
|
---|
| 349 | <p>Reimplemented in <a href="qdomcomment.html#isComment">QDomComment</a>.
|
---|
| 350 | <h3 class=fn>bool <a name="isDocument"></a>QDomNode::isDocument () const<tt> [virtual]</tt>
|
---|
| 351 | </h3>
|
---|
| 352 | Returns TRUE if the node is a document; otherwise returns FALSE.
|
---|
| 353 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 354 | is a <a href="qdomdocument.html">QDomDocument</a>; you can get the QDomDocument with <a href="#toDocument">toDocument</a>().
|
---|
| 355 | <p> <p>See also <a href="#toDocument">toDocument</a>().
|
---|
| 356 |
|
---|
| 357 | <p>Reimplemented in <a href="qdomdocument.html#isDocument">QDomDocument</a>.
|
---|
| 358 | <h3 class=fn>bool <a name="isDocumentFragment"></a>QDomNode::isDocumentFragment () const<tt> [virtual]</tt>
|
---|
| 359 | </h3>
|
---|
| 360 | Returns TRUE if the node is a document fragment; otherwise returns
|
---|
| 361 | FALSE.
|
---|
| 362 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 363 | is a <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>; you can get the QDomDocumentFragment
|
---|
| 364 | with <a href="#toDocumentFragment">toDocumentFragment</a>().
|
---|
| 365 | <p> <p>See also <a href="#toDocumentFragment">toDocumentFragment</a>().
|
---|
| 366 |
|
---|
| 367 | <p>Reimplemented in <a href="qdomdocumentfragment.html#isDocumentFragment">QDomDocumentFragment</a>.
|
---|
| 368 | <h3 class=fn>bool <a name="isDocumentType"></a>QDomNode::isDocumentType () const<tt> [virtual]</tt>
|
---|
| 369 | </h3>
|
---|
| 370 | Returns TRUE if the node is a document type; otherwise returns
|
---|
| 371 | FALSE.
|
---|
| 372 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 373 | is a <a href="qdomdocumenttype.html">QDomDocumentType</a>; you can get the QDomDocumentType with
|
---|
| 374 | <a href="#toDocumentType">toDocumentType</a>().
|
---|
| 375 | <p> <p>See also <a href="#toDocumentType">toDocumentType</a>().
|
---|
| 376 |
|
---|
| 377 | <p>Reimplemented in <a href="qdomdocumenttype.html#isDocumentType">QDomDocumentType</a>.
|
---|
| 378 | <h3 class=fn>bool <a name="isElement"></a>QDomNode::isElement () const<tt> [virtual]</tt>
|
---|
| 379 | </h3>
|
---|
| 380 | Returns TRUE if the node is an element; otherwise returns FALSE.
|
---|
| 381 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 382 | is a <a href="qdomelement.html">QDomElement</a>; you can get the QDomElement with <a href="#toElement">toElement</a>().
|
---|
| 383 | <p> <p>See also <a href="#toElement">toElement</a>().
|
---|
| 384 |
|
---|
| 385 | <p>Example: <a href="outliner-example.html#x1908">xml/outliner/outlinetree.cpp</a>.
|
---|
| 386 | <p>Reimplemented in <a href="qdomelement.html#isElement">QDomElement</a>.
|
---|
| 387 | <h3 class=fn>bool <a name="isEntity"></a>QDomNode::isEntity () const<tt> [virtual]</tt>
|
---|
| 388 | </h3>
|
---|
| 389 | Returns TRUE if the node is an entity; otherwise returns FALSE.
|
---|
| 390 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 391 | is a <a href="qdomentity.html">QDomEntity</a>; you can get the QDomEntity with <a href="#toEntity">toEntity</a>().
|
---|
| 392 | <p> <p>See also <a href="#toEntity">toEntity</a>().
|
---|
| 393 |
|
---|
| 394 | <p>Reimplemented in <a href="qdomentity.html#isEntity">QDomEntity</a>.
|
---|
| 395 | <h3 class=fn>bool <a name="isEntityReference"></a>QDomNode::isEntityReference () const<tt> [virtual]</tt>
|
---|
| 396 | </h3>
|
---|
| 397 | Returns TRUE if the node is an entity reference; otherwise returns
|
---|
| 398 | FALSE.
|
---|
| 399 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 400 | is a <a href="qdomentityreference.html">QDomEntityReference</a>; you can get the QDomEntityReference with
|
---|
| 401 | <a href="#toEntityReference">toEntityReference</a>().
|
---|
| 402 | <p> <p>See also <a href="#toEntityReference">toEntityReference</a>().
|
---|
| 403 |
|
---|
| 404 | <p>Reimplemented in <a href="qdomentityreference.html#isEntityReference">QDomEntityReference</a>.
|
---|
| 405 | <h3 class=fn>bool <a name="isNotation"></a>QDomNode::isNotation () const<tt> [virtual]</tt>
|
---|
| 406 | </h3>
|
---|
| 407 | Returns TRUE if the node is a notation; otherwise returns FALSE.
|
---|
| 408 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 409 | is a <a href="qdomnotation.html">QDomNotation</a>; you can get the QDomNotation with <a href="#toNotation">toNotation</a>().
|
---|
| 410 | <p> <p>See also <a href="#toNotation">toNotation</a>().
|
---|
| 411 |
|
---|
| 412 | <p>Reimplemented in <a href="qdomnotation.html#isNotation">QDomNotation</a>.
|
---|
| 413 | <h3 class=fn>bool <a name="isNull"></a>QDomNode::isNull () const
|
---|
| 414 | </h3>
|
---|
| 415 | Returns TRUE if this node is null (i.e. if it has no type or
|
---|
| 416 | contents); otherwise returns FALSE.
|
---|
| 417 |
|
---|
| 418 | <p>Example: <a href="outliner-example.html#x1909">xml/outliner/outlinetree.cpp</a>.
|
---|
| 419 | <h3 class=fn>bool <a name="isProcessingInstruction"></a>QDomNode::isProcessingInstruction () const<tt> [virtual]</tt>
|
---|
| 420 | </h3>
|
---|
| 421 | Returns TRUE if the node is a processing instruction; otherwise
|
---|
| 422 | returns FALSE.
|
---|
| 423 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 424 | is a <a href="qdomprocessinginstruction.html">QDomProcessingInstruction</a>; you can get the
|
---|
| 425 | QProcessingInstruction with <a href="#toProcessingInstruction">toProcessingInstruction</a>().
|
---|
| 426 | <p> <p>See also <a href="#toProcessingInstruction">toProcessingInstruction</a>().
|
---|
| 427 |
|
---|
| 428 | <p>Reimplemented in <a href="qdomprocessinginstruction.html#isProcessingInstruction">QDomProcessingInstruction</a>.
|
---|
| 429 | <h3 class=fn>bool <a name="isSupported"></a>QDomNode::isSupported ( const <a href="qstring.html">QString</a> & feature, const <a href="qstring.html">QString</a> & version ) const<tt> [virtual]</tt>
|
---|
| 430 | </h3>
|
---|
| 431 | Returns TRUE if the DOM implementation implements the feature <em>feature</em> and this feature is supported by this node in the version
|
---|
| 432 | <em>version</em>; otherwise returns FALSE.
|
---|
| 433 | <p> <p>See also <a href="qdomimplementation.html#hasFeature">QDomImplementation::hasFeature</a>().
|
---|
| 434 |
|
---|
| 435 | <h3 class=fn>bool <a name="isText"></a>QDomNode::isText () const<tt> [virtual]</tt>
|
---|
| 436 | </h3>
|
---|
| 437 | Returns TRUE if the node is a text node; otherwise returns FALSE.
|
---|
| 438 | <p> If this function returns TRUE, it does not imply that this object
|
---|
| 439 | is a <a href="qdomtext.html">QDomText</a>; you can get the QDomText with <a href="#toText">toText</a>().
|
---|
| 440 | <p> <p>See also <a href="#toText">toText</a>().
|
---|
| 441 |
|
---|
| 442 | <p>Reimplemented in <a href="qdomtext.html#isText">QDomText</a>.
|
---|
| 443 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="lastChild"></a>QDomNode::lastChild () const<tt> [virtual]</tt>
|
---|
| 444 | </h3>
|
---|
| 445 | Returns the last child of the node. If there is no child node, a
|
---|
| 446 | <a href="#isNull">null node</a> is returned. Changing the
|
---|
| 447 | returned node will also change the node in the document tree.
|
---|
| 448 | <p> <p>See also <a href="#firstChild">firstChild</a>() and <a href="#childNodes">childNodes</a>().
|
---|
| 449 |
|
---|
| 450 | <h3 class=fn><a href="qstring.html">QString</a> <a name="localName"></a>QDomNode::localName () const<tt> [virtual]</tt>
|
---|
| 451 | </h3>
|
---|
| 452 | If the node uses namespaces, this function returns the local name
|
---|
| 453 | of the node; otherwise it returns <a href="qstring.html#QString-null">QString::null</a>.
|
---|
| 454 | <p> Only nodes of type <a href="#NodeType-enum">ElementNode</a> or
|
---|
| 455 | <a href="#NodeType-enum">AttributeNode</a> can have
|
---|
| 456 | namespaces. A namespace must have been specified at creation time;
|
---|
| 457 | it is not possible to add a namespace afterwards.
|
---|
| 458 | <p> <p>See also <a href="#prefix">prefix</a>(), <a href="#namespaceURI">namespaceURI</a>(), <a href="qdomdocument.html#createElementNS">QDomDocument::createElementNS</a>(), and <a href="qdomdocument.html#createAttributeNS">QDomDocument::createAttributeNS</a>().
|
---|
| 459 |
|
---|
| 460 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="namedItem"></a>QDomNode::namedItem ( const <a href="qstring.html">QString</a> & name ) const
|
---|
| 461 | </h3>
|
---|
| 462 | Returns the first direct child node for which <a href="#nodeName">nodeName</a>() equals <em>name</em>.
|
---|
| 463 | <p> If no such direct child exists, a <a href="#isNull">null node</a>
|
---|
| 464 | is returned.
|
---|
| 465 | <p> <p>See also <a href="#nodeName">nodeName</a>().
|
---|
| 466 |
|
---|
| 467 | <h3 class=fn><a href="qstring.html">QString</a> <a name="namespaceURI"></a>QDomNode::namespaceURI () const<tt> [virtual]</tt>
|
---|
| 468 | </h3>
|
---|
| 469 | Returns the namespace URI of this node or <a href="qstring.html#QString-null">QString::null</a> if the
|
---|
| 470 | node has no namespace URI.
|
---|
| 471 | <p> Only nodes of type <a href="#NodeType-enum">ElementNode</a> or
|
---|
| 472 | <a href="#NodeType-enum">AttributeNode</a> can have
|
---|
| 473 | namespaces. A namespace URI must be specified at creation time and
|
---|
| 474 | cannot be changed later.
|
---|
| 475 | <p> <p>See also <a href="#prefix">prefix</a>(), <a href="#localName">localName</a>(), <a href="qdomdocument.html#createElementNS">QDomDocument::createElementNS</a>(), and <a href="qdomdocument.html#createAttributeNS">QDomDocument::createAttributeNS</a>().
|
---|
| 476 |
|
---|
| 477 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="nextSibling"></a>QDomNode::nextSibling () const<tt> [virtual]</tt>
|
---|
| 478 | </h3>
|
---|
| 479 | Returns the next sibling in the document tree. Changing the
|
---|
| 480 | returned node will also change the node in the document tree.
|
---|
| 481 | <p> If you have XML like this:
|
---|
| 482 | <pre>
|
---|
| 483 | <h1>Heading</h1>
|
---|
| 484 | <p>The text...</p>
|
---|
| 485 | <h2>Next heading</h2>
|
---|
| 486 | </pre>
|
---|
| 487 |
|
---|
| 488 | and this QDomNode represents the <p> tag, <a href="#nextSibling">nextSibling</a>() will
|
---|
| 489 | return the node representing the <h2> tag.
|
---|
| 490 | <p> <p>See also <a href="#previousSibling">previousSibling</a>().
|
---|
| 491 |
|
---|
| 492 | <p>Example: <a href="outliner-example.html#x1910">xml/outliner/outlinetree.cpp</a>.
|
---|
| 493 | <h3 class=fn><a href="qstring.html">QString</a> <a name="nodeName"></a>QDomNode::nodeName () const<tt> [virtual]</tt>
|
---|
| 494 | </h3>
|
---|
| 495 | Returns the name of the node.
|
---|
| 496 | <p> The meaning of the name depends on the subclass:
|
---|
| 497 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 498 | <tr bgcolor="#a2c511"> <th valign="top">Name <th valign="top">Meaning
|
---|
| 499 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomAttr <td valign="top">The name of the attribute
|
---|
| 500 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomCDATASection <td valign="top">The string "#cdata-section"
|
---|
| 501 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomComment <td valign="top">The string "#comment"
|
---|
| 502 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomDocument <td valign="top">The string "#document"
|
---|
| 503 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomDocumentFragment <td valign="top">The string "#document-fragment"
|
---|
| 504 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomDocumentType <td valign="top">The name of the document type
|
---|
| 505 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomElement <td valign="top">The tag name
|
---|
| 506 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomEntity <td valign="top">The name of the entity
|
---|
| 507 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomEntityReference <td valign="top">The name of the referenced entity
|
---|
| 508 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomNotation <td valign="top">The name of the notation
|
---|
| 509 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomProcessingInstruction <td valign="top">The target of the processing instruction
|
---|
| 510 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomText <td valign="top">The string "#text"
|
---|
| 511 | </table></center>
|
---|
| 512 | <p> <p>See also <a href="#nodeValue">nodeValue</a>().
|
---|
| 513 |
|
---|
| 514 | <p>Example: <a href="outliner-example.html#x1911">xml/outliner/outlinetree.cpp</a>.
|
---|
| 515 | <h3 class=fn><a href="qdomnode.html#NodeType-enum">QDomNode::NodeType</a> <a name="nodeType"></a>QDomNode::nodeType () const<tt> [virtual]</tt>
|
---|
| 516 | </h3>
|
---|
| 517 | Returns the type of the node.
|
---|
| 518 | <p> <p>See also <a href="#toAttr">toAttr</a>(), <a href="#toCDATASection">toCDATASection</a>(), <a href="#toDocumentFragment">toDocumentFragment</a>(), <a href="#toDocument">toDocument</a>(), <a href="#toDocumentType">toDocumentType</a>(), <a href="#toElement">toElement</a>(), <a href="#toEntityReference">toEntityReference</a>(), <a href="#toText">toText</a>(), <a href="#toEntity">toEntity</a>(), <a href="#toNotation">toNotation</a>(), <a href="#toProcessingInstruction">toProcessingInstruction</a>(), <a href="#toCharacterData">toCharacterData</a>(), and <a href="#toComment">toComment</a>().
|
---|
| 519 |
|
---|
| 520 | <p>Reimplemented in <a href="qdomdocumenttype.html#nodeType">QDomDocumentType</a>, <a href="qdomdocument.html#nodeType">QDomDocument</a>, <a href="qdomdocumentfragment.html#nodeType">QDomDocumentFragment</a>, <a href="qdomcharacterdata.html#nodeType">QDomCharacterData</a>, <a href="qdomattr.html#nodeType">QDomAttr</a>, <a href="qdomelement.html#nodeType">QDomElement</a>, <a href="qdomnotation.html#nodeType">QDomNotation</a>, <a href="qdomentity.html#nodeType">QDomEntity</a>, <a href="qdomentityreference.html#nodeType">QDomEntityReference</a>, and <a href="qdomprocessinginstruction.html#nodeType">QDomProcessingInstruction</a>.
|
---|
| 521 | <h3 class=fn><a href="qstring.html">QString</a> <a name="nodeValue"></a>QDomNode::nodeValue () const<tt> [virtual]</tt>
|
---|
| 522 | </h3>
|
---|
| 523 | Returns the value of the node.
|
---|
| 524 | <p> The meaning of the value depends on the subclass:
|
---|
| 525 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 526 | <tr bgcolor="#a2c511"> <th valign="top">Name <th valign="top">Meaning
|
---|
| 527 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomAttr <td valign="top">The attribute value
|
---|
| 528 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomCDATASection <td valign="top">The content of the CDATA section
|
---|
| 529 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomComment <td valign="top">The comment
|
---|
| 530 | <tr bgcolor="#d0d0d0"> <td valign="top">QDomProcessingInstruction <td valign="top">The data of the processing intruction
|
---|
| 531 | <tr bgcolor="#f0f0f0"> <td valign="top">QDomText <td valign="top">The text
|
---|
| 532 | </table></center>
|
---|
| 533 | <p> All the other subclasses do not have a node value and will return
|
---|
| 534 | <a href="qstring.html#QString-null">QString::null</a>.
|
---|
| 535 | <p> <p>See also <a href="#setNodeValue">setNodeValue</a>() and <a href="#nodeName">nodeName</a>().
|
---|
| 536 |
|
---|
| 537 | <p>Example: <a href="outliner-example.html#x1912">xml/outliner/outlinetree.cpp</a>.
|
---|
| 538 | <h3 class=fn>void <a name="normalize"></a>QDomNode::normalize ()<tt> [virtual]</tt>
|
---|
| 539 | </h3>
|
---|
| 540 | Calling <a href="#normalize">normalize</a>() on an element converts all its children into a
|
---|
| 541 | standard form. This means that adjacent <a href="qdomtext.html">QDomText</a> objects will be
|
---|
| 542 | merged into a single text object (<a href="qdomcdatasection.html">QDomCDATASection</a> nodes are not
|
---|
| 543 | merged).
|
---|
| 544 |
|
---|
| 545 | <h3 class=fn>bool <a name="operator!-eq"></a>QDomNode::operator!= ( const <a href="qdomnode.html">QDomNode</a> & n ) const
|
---|
| 546 | </h3>
|
---|
| 547 | Returns TRUE if <em>n</em> and this DOM node are not equal; otherwise
|
---|
| 548 | returns FALSE.
|
---|
| 549 |
|
---|
| 550 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> & <a name="operator-eq"></a>QDomNode::operator= ( const <a href="qdomnode.html">QDomNode</a> & n )
|
---|
| 551 | </h3>
|
---|
| 552 | Assigns a copy of <em>n</em> to this DOM node.
|
---|
| 553 | <p> The data of the copy is shared (shallow copy): modifying one node
|
---|
| 554 | will also change the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use
|
---|
| 555 | <a href="#cloneNode">cloneNode</a>().
|
---|
| 556 |
|
---|
| 557 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QDomNode::operator== ( const <a href="qdomnode.html">QDomNode</a> & n ) const
|
---|
| 558 | </h3>
|
---|
| 559 | Returns TRUE if <em>n</em> and this DOM node are equal; otherwise
|
---|
| 560 | returns FALSE.
|
---|
| 561 |
|
---|
| 562 | <h3 class=fn><a href="qdomdocument.html">QDomDocument</a> <a name="ownerDocument"></a>QDomNode::ownerDocument () const<tt> [virtual]</tt>
|
---|
| 563 | </h3>
|
---|
| 564 | Returns the document to which this node belongs.
|
---|
| 565 |
|
---|
| 566 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="parentNode"></a>QDomNode::parentNode () const<tt> [virtual]</tt>
|
---|
| 567 | </h3>
|
---|
| 568 | Returns the parent node. If this node has no parent, a null node
|
---|
| 569 | is returned (i.e. a node for which <a href="#isNull">isNull</a>() returns TRUE).
|
---|
| 570 |
|
---|
| 571 | <h3 class=fn><a href="qstring.html">QString</a> <a name="prefix"></a>QDomNode::prefix () const<tt> [virtual]</tt>
|
---|
| 572 | </h3>
|
---|
| 573 | Returns the namespace prefix of the node or <a href="qstring.html#QString-null">QString::null</a> if the
|
---|
| 574 | node has no namespace prefix.
|
---|
| 575 | <p> Only nodes of type <a href="#NodeType-enum">ElementNode</a> or
|
---|
| 576 | <a href="#NodeType-enum">AttributeNode</a> can have
|
---|
| 577 | namespaces. A namespace prefix must be specified at creation time.
|
---|
| 578 | If a node was created with a namespace prefix, you can change it
|
---|
| 579 | later with <a href="#setPrefix">setPrefix</a>().
|
---|
| 580 | <p> If you create an element or attribute with
|
---|
| 581 | <a href="qdomdocument.html#createElement">QDomDocument::createElement</a>() or <a href="qdomdocument.html#createAttribute">QDomDocument::createAttribute</a>(),
|
---|
| 582 | the prefix will be QString::null. If you use
|
---|
| 583 | <a href="qdomdocument.html#createElementNS">QDomDocument::createElementNS</a>() or
|
---|
| 584 | <a href="qdomdocument.html#createAttributeNS">QDomDocument::createAttributeNS</a>() instead, the prefix will not be
|
---|
| 585 | QString::null; but it might be an empty string if the name does
|
---|
| 586 | not have a prefix.
|
---|
| 587 | <p> <p>See also <a href="#setPrefix">setPrefix</a>(), <a href="#localName">localName</a>(), <a href="#namespaceURI">namespaceURI</a>(), <a href="qdomdocument.html#createElementNS">QDomDocument::createElementNS</a>(), and <a href="qdomdocument.html#createAttributeNS">QDomDocument::createAttributeNS</a>().
|
---|
| 588 |
|
---|
| 589 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="previousSibling"></a>QDomNode::previousSibling () const<tt> [virtual]</tt>
|
---|
| 590 | </h3>
|
---|
| 591 | Returns the previous sibling in the document tree. Changing the
|
---|
| 592 | returned node will also change the node in the document tree.
|
---|
| 593 | <p> For example, if you have XML like this:
|
---|
| 594 | <pre>
|
---|
| 595 | <h1>Heading</h1>
|
---|
| 596 | <p>The text...</p>
|
---|
| 597 | <h2>Next heading</h2>
|
---|
| 598 | </pre>
|
---|
| 599 |
|
---|
| 600 | and this QDomNode represents the <p> tag, <a href="#previousSibling">previousSibling</a>()
|
---|
| 601 | will return the node representing the <h1> tag.
|
---|
| 602 | <p> <p>See also <a href="#nextSibling">nextSibling</a>().
|
---|
| 603 |
|
---|
| 604 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="removeChild"></a>QDomNode::removeChild ( const <a href="qdomnode.html">QDomNode</a> & oldChild )<tt> [virtual]</tt>
|
---|
| 605 | </h3>
|
---|
| 606 | Removes <em>oldChild</em> from the list of children. <em>oldChild</em> must be
|
---|
| 607 | a direct child of this node.
|
---|
| 608 | <p> Returns a new reference to <em>oldChild</em> on success or a <a href="#isNull">null node</a> on failure.
|
---|
| 609 | <p> <p>See also <a href="#insertBefore">insertBefore</a>(), <a href="#insertAfter">insertAfter</a>(), <a href="#replaceChild">replaceChild</a>(), and <a href="#appendChild">appendChild</a>().
|
---|
| 610 |
|
---|
| 611 | <h3 class=fn><a href="qdomnode.html">QDomNode</a> <a name="replaceChild"></a>QDomNode::replaceChild ( const <a href="qdomnode.html">QDomNode</a> & newChild, const <a href="qdomnode.html">QDomNode</a> & oldChild )<tt> [virtual]</tt>
|
---|
| 612 | </h3>
|
---|
| 613 | Replaces <em>oldChild</em> with <em>newChild</em>. <em>oldChild</em> must be a
|
---|
| 614 | direct child of this node.
|
---|
| 615 | <p> If <em>newChild</em> is the child of another node, it is reparented to
|
---|
| 616 | this node. If <em>newChild</em> is a child of this node, then its
|
---|
| 617 | position in the list of children is changed.
|
---|
| 618 | <p> If <em>newChild</em> is a <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>, then <em>oldChild</em> is
|
---|
| 619 | replaced by all of the children of the fragment.
|
---|
| 620 | <p> Returns a new reference to <em>oldChild</em> on success or a <a href="#isNull">null node</a> an failure.
|
---|
| 621 | <p> <p>See also <a href="#insertBefore">insertBefore</a>(), <a href="#insertAfter">insertAfter</a>(), <a href="#removeChild">removeChild</a>(), and <a href="#appendChild">appendChild</a>().
|
---|
| 622 |
|
---|
| 623 | <h3 class=fn>void <a name="save"></a>QDomNode::save ( <a href="qtextstream.html">QTextStream</a> & str, int indent ) const
|
---|
| 624 | </h3>
|
---|
| 625 | Writes the XML representation of the node and all its children to
|
---|
| 626 | the stream <em>str</em>. This function uses <em>indent</em> as the amount of
|
---|
| 627 | space to indent the node.
|
---|
| 628 |
|
---|
| 629 | <h3 class=fn>void <a name="setNodeValue"></a>QDomNode::setNodeValue ( const <a href="qstring.html">QString</a> & v )<tt> [virtual]</tt>
|
---|
| 630 | </h3>
|
---|
| 631 | Sets the node's value to <em>v</em>.
|
---|
| 632 | <p> <p>See also <a href="#nodeValue">nodeValue</a>().
|
---|
| 633 |
|
---|
| 634 | <h3 class=fn>void <a name="setPrefix"></a>QDomNode::setPrefix ( const <a href="qstring.html">QString</a> & pre )<tt> [virtual]</tt>
|
---|
| 635 | </h3>
|
---|
| 636 | If the node has a namespace prefix, this function changes the
|
---|
| 637 | namespace prefix of the node to <em>pre</em>. Otherwise this function
|
---|
| 638 | does nothing.
|
---|
| 639 | <p> Only nodes of type <a href="#NodeType-enum">ElementNode</a> or
|
---|
| 640 | <a href="#NodeType-enum">AttributeNode</a> can have
|
---|
| 641 | namespaces. A namespace prefix must have be specified at creation
|
---|
| 642 | time; it is not possible to add a namespace prefix afterwards.
|
---|
| 643 | <p> <p>See also <a href="#prefix">prefix</a>(), <a href="#localName">localName</a>(), <a href="#namespaceURI">namespaceURI</a>(), <a href="qdomdocument.html#createElementNS">QDomDocument::createElementNS</a>(), and <a href="qdomdocument.html#createAttributeNS">QDomDocument::createAttributeNS</a>().
|
---|
| 644 |
|
---|
| 645 | <h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="toAttr"></a>QDomNode::toAttr ()
|
---|
| 646 | </h3>
|
---|
| 647 | Converts a QDomNode into a <a href="qdomattr.html">QDomAttr</a>. If the node is not an
|
---|
| 648 | attribute, the returned object will be <a href="#isNull">null</a>.
|
---|
| 649 | <p> <p>See also <a href="#isAttr">isAttr</a>().
|
---|
| 650 |
|
---|
| 651 | <h3 class=fn><a href="qdomcdatasection.html">QDomCDATASection</a> <a name="toCDATASection"></a>QDomNode::toCDATASection ()
|
---|
| 652 | </h3>
|
---|
| 653 | Converts a QDomNode into a <a href="qdomcdatasection.html">QDomCDATASection</a>. If the node is not a
|
---|
| 654 | CDATA section, the returned object will be <a href="#isNull">null</a>.
|
---|
| 655 | <p> <p>See also <a href="#isCDATASection">isCDATASection</a>().
|
---|
| 656 |
|
---|
| 657 | <h3 class=fn><a href="qdomcharacterdata.html">QDomCharacterData</a> <a name="toCharacterData"></a>QDomNode::toCharacterData ()
|
---|
| 658 | </h3>
|
---|
| 659 | Converts a QDomNode into a <a href="qdomcharacterdata.html">QDomCharacterData</a>. If the node is not a
|
---|
| 660 | character data node the returned object will be <a href="#isNull">null</a>.
|
---|
| 661 | <p> <p>See also <a href="#isCharacterData">isCharacterData</a>().
|
---|
| 662 |
|
---|
| 663 | <h3 class=fn><a href="qdomcomment.html">QDomComment</a> <a name="toComment"></a>QDomNode::toComment ()
|
---|
| 664 | </h3>
|
---|
| 665 | Converts a QDomNode into a <a href="qdomcomment.html">QDomComment</a>. If the node is not a
|
---|
| 666 | comment the returned object will be <a href="#isNull">null</a>.
|
---|
| 667 | <p> <p>See also <a href="#isComment">isComment</a>().
|
---|
| 668 |
|
---|
| 669 | <h3 class=fn><a href="qdomdocument.html">QDomDocument</a> <a name="toDocument"></a>QDomNode::toDocument ()
|
---|
| 670 | </h3>
|
---|
| 671 | Converts a QDomNode into a <a href="qdomdocument.html">QDomDocument</a>. If the node is not a
|
---|
| 672 | document the returned object will be <a href="#isNull">null</a>.
|
---|
| 673 | <p> <p>See also <a href="#isDocument">isDocument</a>().
|
---|
| 674 |
|
---|
| 675 | <h3 class=fn><a href="qdomdocumentfragment.html">QDomDocumentFragment</a> <a name="toDocumentFragment"></a>QDomNode::toDocumentFragment ()
|
---|
| 676 | </h3>
|
---|
| 677 | Converts a QDomNode into a <a href="qdomdocumentfragment.html">QDomDocumentFragment</a>. If the node is
|
---|
| 678 | not a document fragment the returned object will be <a href="#isNull">null</a>.
|
---|
| 679 | <p> <p>See also <a href="#isDocumentFragment">isDocumentFragment</a>().
|
---|
| 680 |
|
---|
| 681 | <h3 class=fn><a href="qdomdocumenttype.html">QDomDocumentType</a> <a name="toDocumentType"></a>QDomNode::toDocumentType ()
|
---|
| 682 | </h3>
|
---|
| 683 | Converts a QDomNode into a <a href="qdomdocumenttype.html">QDomDocumentType</a>. If the node is not a
|
---|
| 684 | document type the returned object will be <a href="#isNull">null</a>.
|
---|
| 685 | <p> <p>See also <a href="#isDocumentType">isDocumentType</a>().
|
---|
| 686 |
|
---|
| 687 | <h3 class=fn><a href="qdomelement.html">QDomElement</a> <a name="toElement"></a>QDomNode::toElement ()
|
---|
| 688 | </h3>
|
---|
| 689 | Converts a QDomNode into a <a href="qdomelement.html">QDomElement</a>. If the node is not an
|
---|
| 690 | element the returned object will be <a href="#isNull">null</a>.
|
---|
| 691 | <p> <p>See also <a href="#isElement">isElement</a>().
|
---|
| 692 |
|
---|
| 693 | <p>Example: <a href="outliner-example.html#x1913">xml/outliner/outlinetree.cpp</a>.
|
---|
| 694 | <h3 class=fn><a href="qdomentity.html">QDomEntity</a> <a name="toEntity"></a>QDomNode::toEntity ()
|
---|
| 695 | </h3>
|
---|
| 696 | Converts a QDomNode into a <a href="qdomentity.html">QDomEntity</a>. If the node is not an
|
---|
| 697 | entity the returned object will be <a href="#isNull">null</a>.
|
---|
| 698 | <p> <p>See also <a href="#isEntity">isEntity</a>().
|
---|
| 699 |
|
---|
| 700 | <h3 class=fn><a href="qdomentityreference.html">QDomEntityReference</a> <a name="toEntityReference"></a>QDomNode::toEntityReference ()
|
---|
| 701 | </h3>
|
---|
| 702 | Converts a QDomNode into a <a href="qdomentityreference.html">QDomEntityReference</a>. If the node is not
|
---|
| 703 | an entity reference, the returned object will be <a href="#isNull">null</a>.
|
---|
| 704 | <p> <p>See also <a href="#isEntityReference">isEntityReference</a>().
|
---|
| 705 |
|
---|
| 706 | <h3 class=fn><a href="qdomnotation.html">QDomNotation</a> <a name="toNotation"></a>QDomNode::toNotation ()
|
---|
| 707 | </h3>
|
---|
| 708 | Converts a QDomNode into a <a href="qdomnotation.html">QDomNotation</a>. If the node is not a
|
---|
| 709 | notation the returned object will be <a href="#isNull">null</a>.
|
---|
| 710 | <p> <p>See also <a href="#isNotation">isNotation</a>().
|
---|
| 711 |
|
---|
| 712 | <h3 class=fn><a href="qdomprocessinginstruction.html">QDomProcessingInstruction</a> <a name="toProcessingInstruction"></a>QDomNode::toProcessingInstruction ()
|
---|
| 713 | </h3>
|
---|
| 714 | Converts a QDomNode into a <a href="qdomprocessinginstruction.html">QDomProcessingInstruction</a>. If the node
|
---|
| 715 | is not a processing instruction the returned object will be <a href="#isNull">null</a>.
|
---|
| 716 | <p> <p>See also <a href="#isProcessingInstruction">isProcessingInstruction</a>().
|
---|
| 717 |
|
---|
| 718 | <h3 class=fn><a href="qdomtext.html">QDomText</a> <a name="toText"></a>QDomNode::toText ()
|
---|
| 719 | </h3>
|
---|
| 720 | Converts a QDomNode into a <a href="qdomtext.html">QDomText</a>. If the node is not a text,
|
---|
| 721 | the returned object will be <a href="#isNull">null</a>.
|
---|
| 722 | <p> <p>See also <a href="#isText">isText</a>().
|
---|
| 723 |
|
---|
| 724 | <hr><h2>Related Functions</h2>
|
---|
| 725 | <h3 class=fn><a href="qtextstream.html">QTextStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qtextstream.html">QTextStream</a> & str, const <a href="qdomnode.html">QDomNode</a> & node )
|
---|
| 726 | </h3>
|
---|
| 727 |
|
---|
| 728 | <p> Writes the XML representation of the node <em>node</em> and all its
|
---|
| 729 | children to the stream <em>str</em>.
|
---|
| 730 |
|
---|
| 731 | <!-- eof -->
|
---|
| 732 | <hr><p>
|
---|
| 733 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 734 | Copyright © 1995-2007
|
---|
| 735 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 736 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 737 | <td>Copyright © 2007
|
---|
| 738 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 739 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 740 | </table></div></address></body>
|
---|
| 741 | </html>
|
---|