Document.importNode(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Imports a node from another document to this document. This method creates a new copy of the source node.

If the deep parameter is set to true, it imports all children of the specified node. If set to false, it imports only the node itself.

Method returns the imported xml.Node object.

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.importedNode

xml.Node

required

Node from another XML document to import.

options.deep

boolean

required

Use true to import the node, its attributes, and all descendents. Use false to only import the node and its attributes.

Important:

This parameter is not supported on Internet Explorer.

Errors

Error Code

Message

Thrown If

SSS_XML_DOM_EXCEPTION

NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation.

Node cannot be imported.

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.

          ...
var importedNode = xmlDocument1.importNode({
    importedNode : foreignNode,
    deep : true
});
... 

        

Related Topics

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

General Notices