Interface for an element's attribute specifications
![]() | Constructors and Destructor
| ||||
![]() | Constructors and operators
| ||||
![]() | The virtual attribute list interface |
Interface for an element's attribute specifications. The SAX parser implements this interface and passes an instance to the SAX application as the second argument of each startElement event. The instance provided will return valid results only during the scope of the startElement invocation (to save it for future use, the application must make a copy: the AttributeListImpl helper class provides a convenient constructor for doing so). An AttributeList includes only attributes that have been specified or defaulted: #IMPLIED attributes will not be included. There are two ways for the SAX application to obtain information from the AttributeList. First, it can iterate through the entire list:public void startElement (String name, AttributeList atts) { for (int i = 0; i < atts.getLength(); i++) { String name = atts.getName(i); String type = atts.getType(i); String value = atts.getValue(i); [...] } }(Note that the result of getLength() will be zero if there are no attributes.) As an alternative, the application can request the value or type of specific attributes:public void startElement (String name, AttributeList atts) { String identifier = atts.getValue("id"); String label = atts.getValue("label"); [...] }The AttributeListImpl helper class provides a convenience implementation for use by parser or application writers.
virtual const XMLCh* getName(const unsigned int index) const
virtual const XMLCh* getType(const unsigned int index) const
getType(String) virtual const XMLCh* getValue(const unsigned int index) const
getValue(String) virtual const XMLCh* getType(const XMLCh* const name) const
virtual const XMLCh* getValue(const XMLCh* const name) const
alphabetic index hierarchy of classes
XML Parser for C++ 2.0 Copyright © IBM Corp, 1999 Center for Java Technology 10275 N. De Anza Blvd. Cupertino CA 95014 USA Email: xml4c@us.ibm.com |
|