FindNodes method: XmlNode class
Syntax
FindNodes(Path)
Description
Use the FindNodes method to return a reference to an array containing all the XmlNodes that match the path.
The path is specified as the list of tag names, to the node that you want to find, each separated by a slash (/) when a namespace is not specified.
Parameters
| Parameter | Description |
|---|---|
|
Path |
Specify the tag names up to and including the name of the node that you want returned, each separated by a slash (/). This is known as the XPath query language. |
Returns
An array of XmlNode objects. If there is no match for the specified path, an array with 0 elements is returned.
Example
Using the following input:
<?xml version="1.0"?>
<PSmessage>
<MsgData>
<Transaction>
<Record1 class="R">
<Field1>one</Field1>
<Field1>two</Field1>
<Field1>three</Field1>
</Record1>
</Transaction>
</MsgData>
</PSmessage>
The following PeopleCode program finds all of the Field1 nodes:
Local array of XmlNode &field1List;
&field1List = &inXMLDoc.DocumentElement.FindNodes("MsgData/Transaction/Record1⇒
/Field1");
If &field1List.Len = 0 Then
/* do error processing, no nodes returned */
Else
/* do regular processing */
End-If;