Skip to content

Load

Loads XML content into the current node from the $XmlRepository.

1
myXml.Load(xquery: string, parameters: object, collection: string):void

Parameters

string xquery
    XQuery expression to perform to select the content to load.

object parameters
    If the XQuery has binding parameters, this argument specifies a dictionary of parameter values.

string collection
    Optional collection name within the $XmlRepository to load from.

Remarks

This method only loads elements that match the node's XML schema. Non-matching elements are ignored.
Registered namespace prefixes are implicitly declared while performing the XQuery.
If the resulting query returns the same node name as the current node's name, the current node's inner XML is replaced with the result. Otherwise, the resulting nodes are processed as child nodes of the current node.
For more XQuery details, please refer to the XQuery+standard and XQuery+Update standards.

Saving & Loading:

1
2
$Xml.Save('','Settings'); // save current node
$Xml.Load('Settings/*'); // load current node contents

Loading a simple result to the current node:

1
$Xml.Load('Person[Id=1]');

Loading a basic transformed result to the current node:

1
2
3
4
5
6
$Xml.Load('for $c in //Person                         ' +
   'where $c/Surname                                  ' +
   'return                                            ' +
   '  <Person>                                        ' +
   '    <Name>{ $c/Name }</Name>                      ' +
   '  <Person>                                        ');

See Also