PreviousNextIndex

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: LOGICAL

Applies to: SAX-attributes object handle, X-noderef object handle

Syntax
REMOVE-ATTRIBUTE( { attribute-name | index } [, namespaceURI ] )  

attribute-name
index
namespaceURI

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"). 


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex