This method is used to select the specified element from the array of type XmlItems. Based on the selected element, further methods can be executed.
The element is specified using an XPath expression. If the XPath expression matches several elements, the first matching element is selected. If a null string is assigned to the input i_sXpathToElement, the root element becomes selected.
On each call, the search of the specified element is started from the beginning of the array. That is, using the same XPath expression always results in the same element being selected.
The return value of type BOOL indicates TRUE if an element was successfully selected.
A call of this method returns either Ok, XPathExpressionInvalid, or ElementNotFound. Use the property Result to obtain the result of the method.
Input |
Data type |
Description |
---|---|---|
i_sXpathToElement |
STRING[255] |
XPath expression to specify the element to be selected. If a null string is assigned, the root element becomes selected. |
i_refXmlItems |
REFERENCE TO XmlItems |
Array provided by the application which contains the elements and attributes read from or to be written to an XML file. |
Use the syntax of the XPath (XML Path) language to specify the element to be selected.
The table lists the supported XPath expressions:
XPath expression |
Description |
---|---|
|
Selects the first element matching the specified path. |
|
Selects the nth element matching the specified path. |
|
Selects the first element matching the specified path that has the specified attribute. |
|
Selects the first element matching the specified path that has the specified attribute and value. |
The predicates (the expressions within square brackets []
) can be followed by a slash /
together with an element name to address the next child element.
Example: /…/<elementname>[<n>]/<elementname>