GetElementsByTagName method: XmlNode class
Syntax
GetElementsByTagName(TagName)
Description
Use the GetElementsByTagName method to return an array of XmlNode objects that match the specified tag name.
Parameters
| Parameter | Description |
|---|---|
|
TagName |
Specify the tag name that you want to look for. |
Returns
An array of XmlNode. If you specify an invalid tag name, the returned array has 0 elements.
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 Field1 nodes:
Local array of XmlNode &field1List;
&field1List = &inXMLDoc.DocumentElement.GetElementsByTagName("Field1");
If &field1List.Len = 0 Then
/* do error processing, no nodes returned */
Else
/* do regular processing */
End-If;