Skip to content

SelectSingle

Selects a single node by specified xpath.

1
myXml.SelectSingle(xpath: string):Xml

Selects a single node by specified xpath and executes callback function if node found.

1
myXml.SelectSingle(xpath: string, callback: (node: Xml) => void):Xml

Parameters

string xpath
    Selects a single node by specified xpath.

(node: Xml) => void callback
    Callback function to execute on selected node.

Remarks

If multiple nodes found on xpath, first node is selected.

Basic usage

1
2
3
4
var customerNode = $Xml.SelectSingle('//Customer');
if (customerNode) {
  ...
}

If multiple nodes found on xpath, first node is selected.

Using callback function

1
2
3
$Xml.SelectSingle('//Customer', function(customer) {
   var customerId = customer.Evaluate('Id');
});

See Also