GetAttributeValue method: Incoming Business Interlink class
Syntax
GetAttributeValue({attributename | attributenumber})
Description
The GetAttributeValue method gets the value of an attribute within an XML element referenced by a BiDocs object.
Parameters
| Parameter | Description |
|---|---|
|
attributenumber | attributename |
Specify the attribute that you want to get the value for. You can specify either the attribute number (1 for the first attribute, 2 for the second, and so on) or the attribute name (an XML tag.) |
Returns
String. The value of the attribute.
Example
Here is a set of XML request code.
<?xml version="1.0"?>
<postreq>
<email>joe_blow@example.com</email>
<location scenery="great" density="low" blank="eh?">
<city>San Rafael</city>
<state>CA</state>
<zip>94522</zip>
<country>US</country>
</location>
</postreq>
Here is the PeopleCode that gets the value of the second attribute in the location node. &attrValue is low.
Local BIDocs &rootInDoc, &postreqDoc, &locationDoc;
Local string &blob, &attrValue;
&blob = %Request.GetContentBody();
&rootInDoc = GetBiDoc(&blob);
&postreqDoc = &rootInDoc.GetNode("postreq");
&locationDoc = &postreqDoc.GetNode("location");
&attrValue = &locationDoc.GetAttributeValue(2);