DOMDocument.AdoptNode

Syntax:

AdoptNode()

Returned value:

Type: DOMDocument; Undefined.
Adapted node or Undefined if adaptation failed.

Description:

Provides adaptation (adoption) of other document's node. Tries to adopt a node from another document.
If adaptation is supported for the node, then a recursive replacement is done of the document-owner in this node, all its children nodes and attributes.
If the node has a parent node, then at first it is removed from the parent node.
Adaptation rules for node types:
Attribute - Document is set in Undefined, Specified property is set to True;
DocumentFragment - all children of a fragment node are adapted recursively;
Document - cannot be adapted;
DocumentType - cannot be adapted;
Element - attributes with a set property Specified are adapted, for a new node-element attributes are created with default values. All children are adapted recursively;
Entity - cannot be adapted;
EntityReference - only this node is adapted. If an entity with the same name is defined in this document, then an entity value is formed for adapted reference;
Notation - cannot be adapted;
ProcessingInstruction, Text, CDATASection, Comment - adapted.

Availability:

Server, thick client, external connection, Mobile application (server).

Note:

Exception call reasons:
  • An attampt of node adaptation Document, DocumentType;
  • Current document of adapted node is in read-only mode.

    

1C:Enterprise Developer's Community