.TH "DOM::DocumentFragment" 3 "28 Jan 2004" "khtml Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
DOM::DocumentFragment \- \fC \fBDocumentFragment\fP \fP is a 'lightweight' or 'minimal' \fC \fBDocument\fP \fP object.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <dom_doc.h>\fP
.PP
Inherits \fBDOM::Node\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBDocumentFragment\fP (const  \fBDocumentFragment\fP &other)"
.br
.ti -1c
.RI "\fBDocumentFragment\fP (const  \fBNode\fP &other)"
.br
.ti -1c
.RI "\fBDocumentFragment\fP & \fBoperator=\fP (const  \fBNode\fP &other)"
.br
.ti -1c
.RI "\fBDocumentFragment\fP & \fBoperator=\fP (const  \fBDocumentFragment\fP &other)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBDocumentFragment\fP (DocumentFragmentImpl *i)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBDocument\fP"
.br
.ti -1c
.RI "class \fBRange\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
\fC \fBDocumentFragment\fP \fP is a 'lightweight' or 'minimal' \fC \fBDocument\fP \fP 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 \fBNode\fP for this purpose. While it is true that a \fC \fBDocument\fP \fP object could fulfil this role, a \fC \fBDocument\fP \fP object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object. \fC \fBDocumentFragment\fP \fP is such an object.
.PP
Furthermore, various operations -- such as inserting nodes as children of another \fC \fBNode\fP \fP -- may take \fC \fBDocumentFragment\fP \fP objects as arguments; this results in all the child nodes of the \fC \fBDocumentFragment\fP \fP being moved to the child list of this node.
.PP
The children of a \fC \fBDocumentFragment\fP \fP node are zero or more nodes representing the tops of any sub-trees defining the structure of the document. \fC \fBDocumentFragment\fP \fP 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 \fC \fBDocumentFragment\fP \fP might have only one child and that child node could be a \fC \fBText\fP \fP node. Such a structure model represents neither an HTML document nor a well-formed XML document.
.PP
When a \fC \fBDocumentFragment\fP \fP is inserted into a \fC \fBDocument\fP \fP (or indeed any other \fC \fBNode\fP \fP that may take children) the children of the \fC \fBDocumentFragment\fP \fP and not the \fC \fBDocumentFragment\fP \fP itself are inserted into the \fC \fBNode\fP \fP . This makes the \fC \fBDocumentFragment\fP \fP very useful when the user wishes to create nodes that are siblings; the \fC \fBDocumentFragment\fP \fP acts as the parent of these nodes so that the user can use the standard methods from the \fC \fBNode\fP \fP interface, such as \fC \fBinsertBefore()\fP \fP and \fC \fBappendChild()\fP \fP . 
.PP
Definition at line 825 of file dom_doc.h.

.SH "Author"
.PP 
Generated automatically by Doxygen for khtml Library from the source code.
