SAX-attributes object
- Last Updated: October 17, 2024
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
>When the parser encounters the start tag of a new XML element, it
knows to call the startElement callback procedure or
method. At this time, the parser creates a SAX-attributes object and passes it to the
startElement callback as an input parameter. Thus,
when you define your startElement callback, you define
the name of the parameter that holds the handle to this automatically created object and
this is how your callback can access the attributes of the XML element.
For example, suppose the parser encounters an XML start tag that has one or more attributes, such as:
|
StartElement callback method with the attributes parameter.
|
StartElement callback method with the attributes parameter.
|
For more information on StartElement
callback procedure or method, see StartElement.
The parser creates and populates the StartElement callback attributes
parameter with information on the XML element's attributes. In the example, name and id are
attributes. The attributes parameter is a handle to a
SAX-attributes object.
Attributes interface of the Java Sax2
API.For most basic use cases, you will be working with this automatically created SAX-attributes object. For information on programmatically creating your own SAX-attributes object, see Create a SAX-attributes object.
The following table summarizes the attributes and methods of the SAX-attributes object. For complete reference entries, see ABL Reference.
| This attribute or method . . . | Lets you . . . |
|---|---|
NUM-ITEMS attribute |
See how many attributes the XML element has |
GET-INDEX-BY-NAMESPACE-NAME( ) methodGET-INDEX-BY-QNAME( ) method |
Get where on the attribute list a particular attribute resides |
GET-LOCALNAME-BY-INDEX( ) methodGET-QNAME-BY-INDEX( ) methodGET-URI-BY-INDEX( ) method |
Get the name of a particular attribute |
GET-TYPE-BY-INDEX( ) methodGET-TYPE-BY-NAMESPACE-NAME( ) methodGET-TYPE-BY-QNAME( )
method |
Get the type of a particular attribute |
GET-VALUE-BY-INDEX( ) methodGET-VALUE-BY-NAMESPACE-NAME( ) methodGET-VALUE-BY-QNAME( )
method |
Get the value of a particular attribute |
INSERT-ATTRIBUTE( ) methodUPDATE-ATTRIBUE( )
methodREMOVE-ATTRIBUTE( ) method |
Manipulate the attributes in the list |
TYPE attribute |
Get the type of the object (which is
always SAX-ATTRIBUTES) |
ADM-DATA attributeHANDLE attributeINSTANTIATING-PROCEDURE attributePRIVATE-DATA attributeUNIQUE-ID
attribute |
Get or set information concerning this particular SAX-attributes object |
COPY-SAX-ATTRIBUTES( ) method |
Copy the contents of the specified SAX-attributes object to this SAX-attributes object |
A SAX-attributes object represents the complete collection of all the
attributes for a given element. No matter how many attributes an element has, the
StartElement callback gets passed only one
SAX-attributes handle.