Skip to content

$XmlRepository.Query

Overview

string[] $XmlRepository.Query ( xquery, [ parameters ] )
Performs an xquery on repository and returns the results as string array.

Arguments

String h__xqueryh__ Specifies the query to perform on the database. The syntax of the query is quite detailed. More information can be found on xquery standard page.

Object h__parametersh__ Specifies the binding parameters on xquery string.

Remarks

If query does not return any result than return value is empty array.

Examples

Find all customers

var results = $XmlRepository.Query('//Customer');
$Xml.InnerXml( 'Customer', results.join() );

Find all customers

var results = $XmlRepository.Query('//Customer[Id=$id]', {
   id : $Xml.Evaluate('CustomerId')
 });
$Xml.InnerXml( 'Customers', results.join() );

Find all customers

$XmlRepository.Query('for $customer in //Customer[Id=$id] return replace value of node $customer/Name with "Lady Gaga"', {
   id : $Xml.Evaluate('CustomerId')
});

See Also