Skip to content

SelectAll

Selects all matching nodes based on the specified XPath expression.

1
myXml.SelectAll(xpath: string):Array<Xml>

Selects all matching nodes based on the specified XPath expression and executes a callback function for each selected node.

1
myXml.SelectAll(xpath: string, callback?: (node?: Xml, i?: number) => any):Array<any>

Parameters

string xpath
    The XPath expression to use for selecting nodes.

(node?: Xml, i?: number) => any callback optional
    A callback function to execute for each selected node. Optional. The callback function receives the selected node and its index as arguments.

Returns

An array of Xml objects representing the selected nodes. An array containing the results of the callback function for each selected node.

Remarks

Select all matching customer nodes

1
var allCustomers = $Xml.SelectAll('//Customer');

Visit each selected customer node

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

Map selected customer nodes to ID values

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

See Also