Summary:
See also: Classes and Objects, XML Utilities
The SaxAttributes class provides methods to manipulate XML element attributes for a SAX driver.
om.SaxAttributes
Class Methods | |
Name | Description |
copy( src SaxAttributes ) |
Clones an existing SaxAttributes object. |
create() |
Creates a new, empty SaxAttributes object. |
Object Methods | |
Name | Description |
addAttribute( n STRING, v STRING ) |
Adds an attribute to the end of the list. |
clear() |
Clears the attribute list. |
getLength() |
Returns the number of attributes in the list. |
getName( pos INTEGER ) |
Returns the name of the attribute at position pos. |
getValue( att STRING ) |
Returns the value of the attribute identified by the name att. |
getValuebyIndex( pos INTEGER ) |
Returns the value of the attribute at position pos. |
removeAttribute( pos INTEGER ) |
Removes the attribute at position pos. |
setAttributes( atts om.SaxAttributes ) |
Clears the current attribute list and adds all attributes of atts. |
To process element attributes, a SaxAttributes object can
be used in cooperation with an XmlReader object. You get an instance of SaxAttributes with the
getAttributes()
method.
The following SaxAttributes Class methods are also provided:
The om.SaxAttributes.create()
method creates a new, empty
SaxAttributes object.
The om.SaxAttributes.copy()
method clones an existing
SaxAttributes object.
The getValue()
method returns the value of
the attribute specified by name.
The getValueByIndex()
method returns
the value of the attribute at the specified position.
The getLength()
method returns the number of attributes in the list.
The getName()
method returns the name of the attribute at the
specified position in the list.
The addAttribute()
method adds a new attribute to the end of the
attributes list.
The clear()
method clears the attributes list.
The removeAttribute()
method removes
the attributes at the given position in the list.
The setAttributes()
method clears the current list and adds all the
attributes of the specified SaxAttributes object.
01
FUNCTION displayAttributes( a )02
DEFINE a om.SaxAttributes03
DEFINE i INTEGER04
FOR i=1 to a.getLength()05
DISPLAY a.getName(i) || "=[" || a.getValueByIndex(i) || "]"06
END FOR07
END FUNCTION