%XML_ELEM_REMOVEATTRIBUTE

Remove an attribute from an XML element

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %XML_ELEM_REMOVEATTRIBUTE(element, attr_name[, attribute]) 

Return value

status

XML_SUCCESS if the specified attribute is removed. (i4)

Arguments

element

The XML element instance whose attribute will be removed. (XML_ELEM_TYPE)

attr_name

The name of the attribute to remove. (a)

attribute

(optional) The removed attribute. (XML_ATTR_TYPE)

Discussion

This method will remove the first attribute with the specified name in the XML element’s list of attributes. If the attribute argument is specified, you are responsible for deleting memory by calling %XML_ATTR_DELETE for that attribute. If attribute is not specified, %XML_ELEM_REMOVEATTRIBUTE will delete the attribute automatically.

If you need more control in deleting attributes, see %XML_ATTRLIST_REMOVE.

Examples

The example below assumes an XML element called elem has an attribute whose name is attr1:

ret=%xml_elem_removeattribute(elem," attr1")

Or, if we want to keep the removed attribute in a variable called attr, we’d do this:

attr, XML_ATTR_TYPE
ret=%xml_elem_removeattribute(elem, "attr1", attr)
;If it doesn't get added to any attribute lists, delete it when finished:
xcall xml_attr_delete(attr)