<h1>xercesc::DOMDocumentFragment Class Reference</h1><!-- doxytag: class="xercesc::DOMDocumentFragment" --><!-- doxytag: inherits="xercesc::DOMNode" --><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a> is a "lightweight" or "minimal" <aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a> object.
Inheritance diagram for xercesc::DOMDocumentFragment:<p><center><imgsrc="classxercesc_1_1DOMDocumentFragment__inherit__graph.png"border="0"usemap="#xercesc_1_1DOMDocumentFragment__inherit__map"alt="Inheritance graph"></center>
<center><fontsize="2">[<ahref="graph_legend.html">legend</a>]</font></center><ahref="classxercesc_1_1DOMDocumentFragment-members.html">List of all members.</a><tableborder="0"cellpadding="0"cellspacing="0">
<tr><td></td></tr>
<tr><tdcolspan="2"><br><h2>Public Member Functions</h2></td></tr>
<aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a> is a "lightweight" or "minimal" <aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a> object.
<p>
It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a <aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a> for this purpose. While it is true that a <code><aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a></code> object could fulfil this role, a <code><aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a></code> object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object. <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> is such an object. <p>
Furthermore, various operations -- such as inserting nodes as children of another <code><aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a></code> -- may take <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> objects as arguments; this results in all the child nodes of the <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> being moved to the child list of this node. <p>
The children of a <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> node are zero or more nodes representing the tops of any sub-trees defining the structure of the document. <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> nodes do not need to be well-formed XML documents (although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, a <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> might have only one child and that child node could be a <code><aclass="el"href="classxercesc_1_1DOMText.html">DOMText</a></code> node. Such a structure model represents neither an HTML document nor a well-formed XML document. <p>
When a <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> is inserted into a <code><aclass="el"href="classxercesc_1_1DOMDocument.html">DOMDocument</a></code> (or indeed any other <code><aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a></code> that may take children) the children of the <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> and not the <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> itself are inserted into the <code><aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a></code>. This makes the <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> very useful when the user wishes to create nodes that are siblings; the <code><aclass="el"href="classxercesc_1_1DOMDocumentFragment.html">DOMDocumentFragment</a></code> acts as the parent of these nodes so that the user can use the standard methods from the <code><aclass="el"href="classxercesc_1_1DOMNode.html">DOMNode</a></code> interface, such as <code><aclass="el"href="classxercesc_1_1DOMNode.html#b53ebbb7276d3d20d24cb486f948717c">insertBefore()</a></code> and <code><aclass="el"href="classxercesc_1_1DOMNode.html#de4f6d57748def70f0444b004df96a94">appendChild()</a></code>.<p>