XPath.select(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Selects an array of nodes from an XML that match an XPath expression.

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

xml.Node

required

XML node being queried.

options.xpath

string

required

XPath expression used to query node.

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.

In the following code sample, a single node is selected based on the xpath and node parameters. The type of node being selected is an XML document. The xpath parameter matches to the //book expression to locate the node. For more general information about xpath, see XPath Tutorial.

          //Add additional code 
...
var bookNode = xml.XPath.select({
    node : xmlDocument,
    xpath : '//book' 
});
...
//Add additional code 

        

Related Topics

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

General Notices