\section{DOM::Document\-Fragment Class Reference}
\label{classDOM_1_1DocumentFragment}\index{DOM::DocumentFragment@{DOM::DocumentFragment}}
{\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} is a \char`\"{}lightweight\char`\"{} or \char`\"{}minimal\char`\"{} {\tt {\bf Document}{\rm (p.\,\pageref{classDOM_1_1Document})}} object.  


{\tt \#include $<$dom\_\-doc.h$>$}

Inheritance diagram for DOM::Document\-Fragment:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=84pt]{classDOM_1_1DocumentFragment__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for DOM::Document\-Fragment:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=84pt]{classDOM_1_1DocumentFragment__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Document\-Fragment} (const {\bf Document\-Fragment} \&other)\label{classDOM_1_1DocumentFragment_a1}

\item 
{\bf Document\-Fragment} (const {\bf Node} \&other)\label{classDOM_1_1DocumentFragment_a2}

\item 
{\bf Document\-Fragment} \& {\bf operator=} (const {\bf Node} \&other)\label{classDOM_1_1DocumentFragment_a3}

\item 
{\bf Document\-Fragment} \& {\bf operator=} (const {\bf Document\-Fragment} \&other)\label{classDOM_1_1DocumentFragment_a4}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf Document\-Fragment} (Document\-Fragment\-Impl $\ast$i)\label{classDOM_1_1DocumentFragment_b0}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf Document}\label{classDOM_1_1DocumentFragment_n0}

\item 
class {\bf HTMLElement\-Impl}\label{classDOM_1_1DocumentFragment_n1}

\item 
class {\bf Range}\label{classDOM_1_1DocumentFragment_n2}

\end{CompactItemize}


\subsection{Detailed Description}
{\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} is a \char`\"{}lightweight\char`\"{} or \char`\"{}minimal\char`\"{} {\tt {\bf Document}{\rm (p.\,\pageref{classDOM_1_1Document})}} object. 

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 {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})} for this purpose. While it is true that a {\tt {\bf Document}{\rm (p.\,\pageref{classDOM_1_1Document})}} object could fulfil this role, a {\tt {\bf Document}{\rm (p.\,\pageref{classDOM_1_1Document})}} object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object. {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} is such an object.

Furthermore, various operations -- such as inserting nodes as children of another {\tt {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})}} -- may take {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} objects as arguments; this results in all the child nodes of the {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} being moved to the child list of this node.

The children of a {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} node are zero or more nodes representing the tops of any sub-trees defining the structure of the document. {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} 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 {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} might have only one child and that child node could be a {\tt {\bf Text}{\rm (p.\,\pageref{classDOM_1_1Text})}} node. Such a structure model represents neither an HTML document nor a well-formed XML document.

When a {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} is inserted into a {\tt {\bf Document}{\rm (p.\,\pageref{classDOM_1_1Document})}} (or indeed any other {\tt {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})}} that may take children) the children of the {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} and not the {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} itself are inserted into the {\tt {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})}} . This makes the {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} very useful when the user wishes to create nodes that are siblings; the {\tt {\bf Document\-Fragment}{\rm (p.\,\pageref{classDOM_1_1DocumentFragment})}} acts as the parent of these nodes so that the user can use the standard methods from the {\tt {\bf Node}{\rm (p.\,\pageref{classDOM_1_1Node})}} interface, such as {\tt {\bf insert\-Before()}{\rm (p.\,\pageref{classDOM_1_1Node_a19})}} and {\tt {\bf append\-Child()}{\rm (p.\,\pageref{classDOM_1_1Node_a22})}} . 



Definition at line 991 of file dom\_\-doc.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
dom\_\-doc.h\item 
dom\_\-doc.cpp\end{CompactItemize}
