⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qdomdocument.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 3 页
字号:
  docElem.<a href="qdomnode.html#appendChild">appendChild</a>( elem );  </pre> <p> Once <tt>doc</tt> and <tt>elem</tt> go out of scope, the whole internal tree representingthe XML document will get deleted.<p> To create a document using DOM use code like this:<pre>    QDomDocument doc( "MyML" );    <a href="qdomelement.html">QDomElement</a> root = doc.<a href="#createElement">createElement</a>( "MyML" );    doc.<a href="qdomnode.html#appendChild">appendChild</a>( root );    <a href="qdomelement.html">QDomElement</a> tag = doc.<a href="#createElement">createElement</a>( "Greeting" );    root.<a href="qdomnode.html#appendChild">appendChild</a>( tag );    <a href="qdomtext.html">QDomText</a> t = doc.<a href="#createTextNode">createTextNode</a>( "Hello World" );    tag.<a href="qdomnode.html#appendChild">appendChild</a>( t );    <a href="qstring.html">QString</a> xml = doc.<a href="#toString">toString</a>();    </pre> <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 introduction of the DOM implementation see theQDomDocument documentation.<p>See also <a href="xml-tools.html">XML</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QDomDocument"></a>QDomDocument::QDomDocument ()</h3>Constructs an empty document.<h3 class=fn><a name="QDomDocument-2"></a>QDomDocument::QDomDocument ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )</h3>Creates a document and sets the name of the document type to <em>name</em>.<h3 class=fn><a name="QDomDocument-3"></a>QDomDocument::QDomDocument ( const&nbsp;<a href="qdomdocumenttype.html">QDomDocumentType</a>&nbsp;&amp;&nbsp;doctype )</h3>Creates a document with the document type <em>doctype</em>.<p> <p>See also <a href="qdomimplementation.html#createDocumentType">QDomImplementation::createDocumentType</a>().<h3 class=fn><a name="QDomDocument-4"></a>QDomDocument::QDomDocument ( const&nbsp;<a href="qdomdocument.html">QDomDocument</a>&nbsp;&amp;&nbsp;x )</h3>Constructs a copy of <em>x</em>.<p> The data of the copy is shared (shallow copy): modifying one node will alsochange the other. If you want to make a <a href="shclass.html#deep-copy">deep copy</a>, use <a href="qdomnode.html#cloneNode">cloneNode</a>().<h3 class=fn><a name="~QDomDocument"></a>QDomDocument::~QDomDocument ()</h3>Destroys the object and frees its resources.<h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="createAttribute"></a>QDomDocument::createAttribute ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )</h3>Creates a new attribute called <em>name</em> that can be inserted into anelement, e.g. using <a href="qdomelement.html#setAttributeNode">QDomElement::setAttributeNode</a>().<p> <p>See also <a href="#createAttributeNS">createAttributeNS</a>().<h3 class=fn><a href="qdomattr.html">QDomAttr</a> <a name="createAttributeNS"></a>QDomDocument::createAttributeNS ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;nsURI, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;qName )</h3>Creates a new attribute with namespace support that can be inserted into anelement. The name of the attribute is <em>qName</em> and the namespace URIis <em>nsURI</em>. This function also sets <a href="qdomnode.html#prefix">QDomNode::prefix</a>() and<a href="qdomnode.html#localName">QDomNode::localName</a>() to appropriate values (depending on <em>qName</em>).<p> <p>See also <a href="#createAttribute">createAttribute</a>().<h3 class=fn><a href="qdomcdatasection.html">QDomCDATASection</a> <a name="createCDATASection"></a>QDomDocument::createCDATASection ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;value )</h3>Creates a new CDATA section for the string <em>value</em> that can be inserted intothe document, e.g. using <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>().<p> <p>See also <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(), <a href="qdomnode.html#insertBefore">QDomNode::insertBefore</a>() and <a href="qdomnode.html#insertAfter">QDomNode::insertAfter</a>().<h3 class=fn><a href="qdomcomment.html">QDomComment</a> <a name="createComment"></a>QDomDocument::createComment ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;value )</h3>Creates a new comment for the string <em>value</em> that can be inserted into thedocument, e.g. using <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>().<p> <p>See also <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(), <a href="qdomnode.html#insertBefore">QDomNode::insertBefore</a>() and <a href="qdomnode.html#insertAfter">QDomNode::insertAfter</a>().<h3 class=fn><a href="qdomdocumentfragment.html">QDomDocumentFragment</a> <a name="createDocumentFragment"></a>QDomDocument::createDocumentFragment ()</h3>Creates a new document fragment, that can be used to hold parts of thedocument, e.g. when doing complex manipulations of the document tree.<h3 class=fn><a href="qdomelement.html">QDomElement</a> <a name="createElement"></a>QDomDocument::createElement ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;tagName )</h3>Creates a new element called <em>tagName</em> that can be inserted into theDOM tree, e.g. using <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>().<p> <p>See also <a href="#createElementNS">createElementNS</a>(), <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(), <a href="qdomnode.html#insertBefore">QDomNode::insertBefore</a>() and <a href="qdomnode.html#insertAfter">QDomNode::insertAfter</a>().<h3 class=fn><a href="qdomelement.html">QDomElement</a> <a name="createElementNS"></a>QDomDocument::createElementNS ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;nsURI, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;qName )</h3>Creates a new element with namespace support that can be inserted into theDOM tree. The name of the element is <em>qName</em> and the namespace URIis <em>nsURI</em>. This function also sets <a href="qdomnode.html#prefix">QDomNode::prefix</a>() and<a href="qdomnode.html#localName">QDomNode::localName</a>() to appropriate values (depending on <em>qName</em>).<p> <p>See also <a href="#createElement">createElement</a>().<h3 class=fn><a href="qdomentityreference.html">QDomEntityReference</a> <a name="createEntityReference"></a>QDomDocument::createEntityReference ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )</h3>Creates a new entity reference called <em>name</em> that can be insertedinto the document, e.g. using <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>().<p> <p>See also <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(), <a href="qdomnode.html#insertBefore">QDomNode::insertBefore</a>() and <a href="qdomnode.html#insertAfter">QDomNode::insertAfter</a>().<h3 class=fn><a href="qdomprocessinginstruction.html">QDomProcessingInstruction</a> <a name="createProcessingInstruction"></a>QDomDocument::createProcessingInstruction ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;target, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;data )</h3>Creates a new processing instruction that can be inserted into the document,e.g. using <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(). This function sets the target for theprocessing instruction to <em>target</em> and the data to <em>data</em>.<p> <p>See also <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(), <a href="qdomnode.html#insertBefore">QDomNode::insertBefore</a>() and <a href="qdomnode.html#insertAfter">QDomNode::insertAfter</a>().<h3 class=fn><a href="qdomtext.html">QDomText</a> <a name="createTextNode"></a>QDomDocument::createTextNode ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;value )</h3>Creates a text node for the string <em>value</em> that can be inserted into thedocument tree, e.g. using <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>().<p> <p>See also <a href="qdomnode.html#appendChild">QDomNode::appendChild</a>(), <a href="qdomnode.html#insertBefore">QDomNode::insertBefore</a>() and <a href="qdomnode.html#insertAfter">QDomNode::insertAfter</a>().<h3 class=fn><a href="qdomdocumenttype.html">QDomDocumentType</a> <a name="doctype"></a>QDomDocument::doctype () const</h3>Returns the document type of this document.<h3 class=fn><a href="qdomelement.html">QDomElement</a> <a name="documentElement"></a>QDomDocument::documentElement () const</h3>Returns the root element of the document.<h3 class=fn><a href="qdomelement.html">QDomElement</a> <a name="elementById"></a>QDomDocument::elementById ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;elementId )</h3>Returns the element whose ID is equal to <em>elementId</em>. If no element with theID was found, this function returns a null element.<p> Since the actual version of the QDomClasses does not know which attributesare element IDs, this function returns always a null element. This may changein a future version.<h3 class=fn><a href="qdomnodelist.html">QDomNodeList</a> <a name="elementsByTagName"></a>QDomDocument::elementsByTagName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;tagname ) const</h3>Returns a <a href="qdomnodelist.html">QDomNodeList</a>, that contains all the elements in the documentwith the name <em>tagname</em>. The order of the node list is the order they areencountered in a preorder traversal of the element tree.<p> <p>See also <a href="#elementsByTagNameNS">elementsByTagNameNS</a>() and <a href="qdomelement.html#elementsByTagName">QDomElement::elementsByTagName</a>().<h3 class=fn><a href="qdomnodelist.html">QDomNodeList</a> <a name="elementsByTagNameNS"></a>QDomDocument::elementsByTagNameNS ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;nsURI, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;localName )</h3>Returns a <a href="qdomnodelist.html">QDomNodeList</a> that contains all the elements in the documentwith the local name <em>localName</em> and a namespace URI of <em>nsURI</em>. The orderof the node list, is the order they are encountered in a preorder traversalof the element tree.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -