Document.adoptNode(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Attempts to adopt a node from another document to this document.

If successful, this method changes the Node.ownerDocument property of the source node, its children, and any attribute nodes to the current document. If the source node has a parent node, the parent node is first removed from the child list of its own parent node.

Important:

This method is not supported on Internet Explorer.

Returns

xml.Node

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/xml Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.source

xml.Node

required

Source node to add as a child into the current node object.

Errors

Error Code

Message

Thrown If

SSS_XML_DOM_EXCEPTION

NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.

Node cannot be adopted.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/xml Module Script Samples.

          //Add additional code 
...
var adoptedNode = xmlDocument1.adoptNode({
    source : sourceNode,
});
...
//Add additional code 

        

Related Topics

xml.Document
N/xml Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices