Routines (alphabetical) > Object Classes > File Format Object Classes > IDLffXMLDOMDocumentFragment

# IDLffXMLDOMDocumentFragment

Superclasses | Creation | Properties | Methods | Version History

The IDLffXMLDOMDocumentFragment class references a document-fragment node.

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 such as “cut” or rearranging a document by moving fragments around. It is desirable to have an object that can hold such fragments, and it is quite natural to use a node for this purpose. While it is true that a document object could fill this role, it can potentially be a heavyweight object, depending on the underlying implementation. What you need for this purpose, instead, is a very lightweight object, and the document-fragment node is such an object.

Furthermore, various operations such as inserting nodes as children of another node may take document-fragment objects as arguments; this results in all the child nodes of the document-fragment node being moved to the child list of this node.

The children of a document-fragment node are zero or more nodes representing the roots of any sub-trees defining the structure of the document. Document-fragment 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 root nodes). For example, a document-fragment node might have only one child, and that child node could be a text node. Such a structure model represents neither an HTML document nor a well-formed XML document.

When a document-fragment node is inserted into a document tree (or, indeed, any other node that may take children), the children of the document-fragment node and not the document-fragment node itself are inserted into the node. This insertion process makes the document-fragment node very useful when you want to create nodes that are siblings. Because the document-fragment node acts as the parent of these nodes, you can use the standard methods from the node object, such as InsertBefore() and AppendChild().

There are no methods specific to this class except Cleanup and Init.

## Superclasses

IDLffXMLDOMNode

## Creation

See IDLffXMLDOMDocumentFragment::Init.

## Properties

Objects of this class have no properties of their own, but do have properties inherited from any superclasses.

## Methods

This class has the following methods:

- IDLffXMLDOMDocumentFragment::Cleanup
- IDLffXMLDOMDocumentFragment::Init

In addition, this class inherits the methods of any superclasses.

## Version History

6.1 | Introduced