%XML_ELEM_SETATTRIBUTE
Add an attribute to an XML element
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
status = %XML_ELEM_SETATTRIBUTE(element, attr_name, attr_value)
Return value
status
XML_SUCCESS if the attribute was set successfully.
Arguments
element
The XML element instance for which an attribute is being set. (XML_ELEM_TYPE)
attr_name
The name of the attribute to look for or set. The maximum length is 256 characters. (a)
attr_value
The value of the attribute. The maximum length is 65,022 characters. (a)
Discussion
%XML_ELEM_SETATTRIBUTE looks for an XML attribute by name. If it finds it, it updates the attribute’s value. If it cannot find the attribute, it adds a new attribute to the element’s attribute list using the specified name and value.
In the XML document, attributes are written in an element’s start tag after the tag name, beginning with the name of the attribute, followed by an equal sign (=) and a value for the attribute. For example, in
<structure name="mystruct" >
name = “mystruct” is the attribute and its value.
This function is defined as ^VAL.
See also
%XML_OPTION routine for information about escaping text when calling %XML_ELEM_SETATTRIBUTE
Examples
xcall xml_elem_setAttribute(f1, "name", "id") xcall xml_elem_setAttribute(f1, "type", "decimal") xcall xml_elem_setAttribute(f1, "size", "4")
For a complete example, see Example of assembling XML.