PreviousNextIndex

UPDATE-ATTRIBUTE( ) method

Finds an attribute and updates its value within a SAX-attributes object.

Return type: LOGICAL

Applies to: SAX-attributes object handle

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

attribute-name
index
attribute-value
namespaceURI

Call this method to update an attribute value within a SAX-attributes object. For example, if an XML element obtained from the SAX-reader object need to be modified before being used to write the XML element to a document being written by the SAX-writer object, use this method to find and update the attributes.

The index values of attributes left in the list is then updated to reflect the removed attribute. The NUM-ITEMS 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 return FALSE.

If using an attribute-name, the method updates the first match it finds in the list.

The following are examples:

DEFINE VARIABLE hSAX-attributes as HANDLE. 
CREATE SAX-ATTRIBUTES hSAX-attributes. 
hSAX-attributes:INSERT-ATTRIBUTE( “language”, “EN” ). /* index = 1 */ 
hSAX-attributes:INSERT-ATTRIBUTE( “year”, “2005” ).   /* index = 2 */ 
hSAX-attributes:UPDATE-ATTRIBUTE( “year”, “2006”). 
hSAX-attributes:UPDATE-ATTRIBUTE( 2, “2007”). 

See also: INSERT-ATTRIBUTE( ) method, REMOVE-ATTRIBUTE( ) method


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex