Click to return to the XML (Extensible Markup Language) home page    
XMLDOMDocument Object     XMLDOMDocumentType Object     XML XMLDOM Objects    
Web Workshop  |  XML (Extensible Markup Language)

XMLDOMDocumentFragment Object


The XMLDOMDocumentFragment object is a lightweight object that is useful for tree insert operations.

Remarks

The XMLDOMDocumentFragment object can represent a fragment of a document or portion of a document's tree. This makes it useful when implementing end-user commands that allow users to rearrange a document, such as cutting and pasting.

The XMLDOMDocumentFragment node has special, defined behavior for XMLDOMNode insert operations that makes it especially convenient for developers. When an XMLDOMDocumentFragment is inserted into an XMLDOMDocument node (or other node that can take children), the children of the DocumentFragment are inserted into the node, rather than the DocumentFragment itself. This makes the DocumentFragment useful when the user wants to create nodes that are siblings; the DocumentFragment acts as the parent of these nodes so the user can use the standard methods from the Node interface, such as insertBefore and appendChild.

The children of a DocumentFragment node are zero or more nodes representing the tops of any subtrees 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, a DocumentFragment 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.

This object has no unique properties or methods of its own, but exposes the same objects and properties as the XMLDOMNode object.

Members



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.