{
    "mode": "perldoc",
    "parameter": "XML::DOM::DocumentFragment",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ADOM%3A%3ADocumentFragment/json",
    "generated": "2026-06-12T11:44:43Z",
    "sections": {
        "NAME": {
            "content": "XML::DOM::DocumentFragment - Facilitates cut & paste in XML::DOM documents\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "XML::DOM::DocumentFragment extends XML::DOM::Node\n\nDocumentFragment is a \"lightweight\" or \"minimal\" Document object. It is very common to want to\nbe able to extract a portion of a document's tree or to create a new fragment of a document.\nImagine implementing a user command like cut or rearranging a document by moving fragments\naround. It is desirable to have an object which can hold such fragments and it is quite natural\nto use a Node for this purpose. While it is true that a Document object could fulfil this role,\na Document object can potentially be a heavyweight object, depending on the underlying\nimplementation. What is really needed for this is a very lightweight object. DocumentFragment is\nsuch an object.\n\nFurthermore, various operations -- such as inserting nodes as children of another Node -- may\ntake DocumentFragment objects as arguments; this results in all the child nodes of the\nDocumentFragment being moved to the child list of this node.\n\nThe children of a DocumentFragment node are zero or more nodes representing the tops of any\nsub-trees defining the structure of the document. DocumentFragment nodes do not need to be\nwell-formed XML documents (although they do need to follow the rules imposed upon well-formed\nXML parsed entities, which can have multiple top nodes). For example, a DocumentFragment might\nhave only one child and that child node could be a Text node. Such a structure model represents\nneither an HTML document nor a well-formed XML document.\n\nWhen a DocumentFragment is inserted into a Document (or indeed any other Node that may take\nchildren) the children of the DocumentFragment and not the DocumentFragment itself are inserted\ninto the Node. This makes the DocumentFragment very useful when the user wishes to create nodes\nthat are siblings; the DocumentFragment acts as the parent of these nodes so that the user can\nuse the standard methods from the Node interface, such as insertBefore() and appendChild().\n",
            "subsections": []
        }
    },
    "summary": "XML::DOM::DocumentFragment - Facilitates cut & paste in XML::DOM documents",
    "flags": [],
    "examples": [],
    "see_also": []
}