AddAttribute method: Incoming Business Interlink class
Syntax
AddAttribute(attributename, attributevalue)
Description
The AddAttribute method adds an attribute name and its value to an XML element referenced by a BiDocs object.
Parameters
| Parameter | Description |
|---|---|
|
attributename |
String. The name of the attribute. |
|
attributevalue |
String. The value of the attribute. |
Returns
Number. The return status. NoError, or 0, means the method succeeded.
Example
Here is a set of XML response code.
<?xml version="1.0"?>
<postreqresponse>
<candidate>
<user>
<location scenery="great" density="low" blank="eh?">
</location>
</user>
</candidate>
</postreqresponse>
Here is the PeopleCode that builds it.
Local BIDocs &rootDoc, &postreqresponse;
Local BIDocs &candidates, &location, &user;
Local number &ret;
&rootDoc = GetBiDoc("");
&ret = &rootDoc.AddProcessInstruction("<?xml version=""1.0""?>");
&postreqresponse = &rootDoc.CreateElement("postreqresponse");
&candidates = &postreqresponse.CreateElement("candidates");
&user = &candidates.CreateElement("user");
&location = &user.CreateElement("location");
&ret = &location.AddAttribute("scenery", "great");
&ret = &location.AddAttribute("density", "low");
&ret = &location.AddAttribute("blank", "eh?");
Related Topics