DOMDocument.ImportNode
Syntax:
Parameters:
<Node> (required)
Imported DOM node.
<Recursively> (required)
Flag of a "deep" import. True - all children nodes of the imported node will be recursively imported. The following nodes make an exception: Attribute and EntityReference.
Children nodes for Attribute are always imported, for EntityReference - children nodes are not imported.
If False - only transferred node is imported.
Returned value:
Description:
NodeType and NodeName are imported for each node, as well as properties related to the namespaces: LocalName, Prefix, NameSpaceURI. User data are not transferred.
Import rules for node types:
- Attribute - OwnerElement is set to Undefined, Specified flag is set to True, all node children are imported;
- DocumentFragment - if the flag of a "deep" import is set, then all children of the fragment are copied recursively to the new fragment, otherwise an empty node is created DocumentFragment
- Document - cannot be imported;
- DocumentType - cannot be imported;
- Element - attributes with a set property Specified are imported, for the new node-element attributes are created with default values;
- Entity - nodes can be imported even if the document is "read-only". Properties PublicId, SystemId and NotationName are copied;
- EntityReference - only this node is imported. If an entity with the same name is defined in this document, then an entity value is formed for imported reference;
- Notation - nodes can be imported even if the document is "read-only". Properties PublicId, SystemId are copied;
- ProcessingInstruction - properties are copied Target and Data;
- Text, CDATASection, Comment - properties are copied DOMText.Data, DOMComment.Data, DOMCDATASection.Data and DOMText.Length, DOMComment.Length, DOMCDATASection.Length.
Availability:
Note:
- Imported names contain charaters invalid for XML standard of this document.