DocumentFragment
is a "lightweight" or "minimal"Document
object
Constructors and assignment operators
| |||||||||
Destructor
|
Cloning function.
Destructor.
Equality and Inequality operators.
Functions introduced in DOM Level 2.
null
if it is unspecified
null
if it is unspecified
Functions to modify the DOM Node.
newChild
before the existing child node
refChild
oldChild
with newChild
in the list of children, and returns the oldChild
node
oldChild
from the list
of children, and returns it
newChild
to the end of the list of children of
this node
Get functions.
NodeList
that contains all children of this node
NamedNodeMap
containing the attributes of this node (if it
is an Element
) or null
otherwise
Document
object associated with this node
Query functions.
Set functions.
DocumentFragment
is a "lightweight" or "minimal"Document
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 Node for this purpose. While it is true that aDocument
object could fulfil this role, aDocument
object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.DocumentFragment
is such an object.Furthermore, various operations -- such as inserting nodes as children of another
Node
-- may takeDocumentFragment
objects as arguments; this results in all the child nodes of theDocumentFragment
being moved to the child list of this node.The children of a
DocumentFragment
node are zero or more nodes representing the tops of any sub-trees defining the structure of the document.DocumentFragment
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, aDocumentFragment
might have only one child and that child node could be aText
node. Such a structure model represents neither an HTML document nor a well-formed XML document.When a
DocumentFragment
is inserted into aDocument
(or indeed any otherNode
that may take children) the children of theDocumentFragment
and not theDocumentFragment
itself are inserted into theNode
. This makes theDocumentFragment
very useful when the user wishes to create nodes that are siblings; theDocumentFragment
acts as the parent of these nodes so that the user can use the standard methods from theNode
interface, such asinsertBefore()
andappendChild()
.
DOM_DocumentFragment
. The resulting object does not
refer to an actual Document Fragment node; it will compare == to 0, and is similar
to a null object reference variable in Java. It may subsequently be
assigned to refer to an actual Document Fragment node.
New document fragment nodes are created by DOM_Document::createDocumentFragment().
DOM_DocumentFragment
that refers to the
same underlying node as the original. See also DOM_Node::clone(),
which will copy the actual Document fragment node, rather than just creating a new
reference to the original node.
alphabetic index hierarchy of classes
XML Parser for C++ 2.0 Copyright © IBM Corp, 1999 Center for Java Technology 10275 N. De Anza Blvd. Cupertino CA 95014 USA Email: xml4c@us.ibm.com |
|