Document fragments

A fragment of the document can be attached temporarily to a 'lightweight' object, formally called a DocumentFragment node. This can also be thought of as a 'scratchpad' or 'clipboard'.

The most interesting characteristic of this node is that it dissolves when it is attached to another node as a child. Its children are promoted to be direct children of the node that it became (temporarily) attached to:

However, if the final location is already known, it is perhaps easier just to move each node directly to its intended location. This node type is probably only relevant when the application really does not know the ultimate destination ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.