QuickBooks Integrator 2020 Node.js Edition

Questions / Feedback?

XPath Property

Provides a way to point to a specific element in the document.

Syntax

 qbobject.getXPath([callback])
 qbobject.setXPath( XPath, [callback])

Default Value

""

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getXPath([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setXPath([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

XPath implements a subset of the XML XPath specification, allowing you to point to specific elements in the XML response.

The path is a series of one or more element accessors separated by '/'. The path can be absolute (starting with '/') or relative to the current XPath location.

The following are possible values for an element accessor:

'name'A particular element name.
[i]The i-th subelement of the current element, starting at index 1.
..the parent of the current element.

When XPath is set to a valid path, XElement points to the name of the element, with XChildren and XText providing other properties of the element.

Example (Setting XPath)


Document root QBObjectControl.XPath = "/"
Specific Element QBObjectControl.XPath = "/root/SubElement1/SubElement2/"
i-th Child QBObjectControl.XPath = "/root/[i]"

You may use the HasXPath method to determine if an xpath exists before setting the XPath property.

This property is not available at design time.

Data Type

String

Copyright (c) 2021 /n software inc. - All rights reserved.
QuickBooks Integrator 2020 Node.js Edition - Version 20.0 [Build 7941]