GetElementsByTagNameNS method: XmlNode class
Syntax
GetElementsByTagNameNS(NamespaceURI, TagName)
Where NamespaceURI can have one of the following forms:
URL.URLName
Or a string URL, such as:
http://www.example.com/
Description
Use the GetElementsByTagNameNS method to return an array of XmlNode objects that match the specified namespace and qualified name.
Parameters
| Parameter | Description |
|---|---|
|
NamespaceURI |
Specify the URI that contains the Namespace for the XmlDoc, as a string. |
|
TagName |
Specify the name of the element that you want to retrieve. |
Returns
An array of XmlNode. If you specify an invalid NamespaceURI, the returned array has 0 elements.
Example
Using the following input:
<?xml version="1.0"?>
<Psmessage xmlns="http://www.example.com">
<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.GetElementsByTagNameNS("http:⇒
//www.example.com", "Field1");
If &field1List.Len = 0 Then
/* do error processing, no nodes returned */
Else
/* do regular processing */
End-If;