1XML::DOM::DocumentFragmUesnetr(3C)ontributed Perl DocumeXnMtLa:t:iDoOnM::DocumentFragment(3)
2
3
4

NAME

6       XML::DOM::DocumentFragment - Facilitates cut & paste in XML::DOM
7       documents
8

DESCRIPTION

10       XML::DOM::DocumentFragment extends XML::DOM::Node
11
12       DocumentFragment is a "lightweight" or "minimal" Document object. It is
13       very common to want to be able to extract a portion of a document's
14       tree or to create a new fragment of a document. Imagine implementing a
15       user command like cut or rearranging a document by moving fragments
16       around. It is desirable to have an object which can hold such fragments
17       and it is quite natural to use a Node for this purpose. While it is
18       true that a Document object could fulfil this role, a Document object
19       can potentially be a heavyweight object, depending on the underlying
20       implementation. What is really needed for this is a very lightweight
21       object. DocumentFragment is such an object.
22
23       Furthermore, various operations -- such as inserting nodes as children
24       of another Node -- may take DocumentFragment objects as arguments; this
25       results in all the child nodes of the DocumentFragment being moved to
26       the child list of this node.
27
28       The children of a DocumentFragment node are zero or more nodes
29       representing the tops of any sub-trees defining the structure of the
30       document. DocumentFragment nodes do not need to be well-formed XML
31       documents (although they do need to follow the rules imposed upon well-
32       formed XML parsed entities, which can have multiple top nodes).  For
33       example, a DocumentFragment might have only one child and that child
34       node could be a Text node. Such a structure model represents neither an
35       HTML document nor a well-formed XML document.
36
37       When a DocumentFragment is inserted into a Document (or indeed any
38       other Node that may take children) the children of the DocumentFragment
39       and not the DocumentFragment itself are inserted into the Node. This
40       makes the DocumentFragment very useful when the user wishes to create
41       nodes that are siblings; the DocumentFragment acts as the parent of
42       these nodes so that the user can use the standard methods from the Node
43       interface, such as insertBefore() and appendChild().
44
45
46
47perl v5.32.1                      2021-01-27     XML::DOM::DocumentFragment(3)
Impressum