Previous Next

REMOVE-ATTRIBUTE( ) method
Removes the specified attribute of an element. If the removed attribute has a default value (specified by the document’s DTD) it is set to its default value.
Return type:
Applies to:
 
Syntax 
REMOVE-ATTRIBUTE ( { attribute-name | index } [ , namespaceURI ] ) 
attribute-name
A CHARACTER expression evaluating to the fully qualified or unqualified name of the attribute.
index
For SAX-attributes object handle only. An integer expression evaluating to the position of the attribute in the attribute list. The first attribute has an index of 1. When using index, namespaceURI must be the Unknown value (?), an empty string, or not supplied. Otherwise, an invalid argument error will be raised.
namespaceURI
A CHARACTER expression evaluating to:
*
*
*
The Unknown value (?) if the attribute doesn’t contain a namespace
Call this method to remove an attribute from a SAX-attributes object or an X-noderef object. For example, if an XML element obtained from the SAX-reader object has a larger set of attributes than that required by the document being written by the SAX-writer, use this method to find and remove the extra attributes.
The index values of attributes left in the list is then updated to reflect the removed attribute. The SAX-attributes NUM-ITEMS attribute value will also be decremented to reflect the removed attribute.
If the method fails to find a match, because the name is not found or the index position is invalid, then the method will not remove an attribute and return FALSE.
If using an attribute-name, the method removes the first match it finds in the list.
The following are examples for a SAX-attributes object:
 
DEFINE VARIABLE hSAX-attributes AS HANDLE NO-UNDO.
 
CREATE SAX-ATTRIBUTES hSAX-attributes.
 
hSAX-attributes:INSERT-ATTRIBUTE( “language”, “EN” ). /* index = 1 */
hSAX-attributes:INSERT-ATTRIBUTE( “year”, “2006” ).   /* index = 2 */
 
hSAX-attributes:REMOVE-ATTRIBUTE( “language” ).
hSAX-attributes:REMOVE-ATTRIBUTE( 1 ).                /* removes “year” */
The following X-noderef object example removes the attribute “Id”, or resets the attribute “Id” to its default value, for the XML node represented by hNoderef:
 
hNoderef:REMOVE-ATTRIBUTE("Id").

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.