Handling Attributes

Attributes are not reported through separate callbacks. Instead an Attributes object containing all the attributes of an element is passed to the startElement() method for the start-tag or empty-element tag of the element that possesses the attributes. Example 6.8 summarizes the Attributes interface.

Example 6.8. The SAX Attributes Interface
 package org.xml.sax; public interface Attributes { public int getLength (); public String getQName(int index); public String getURI(int index); public String getLocalName(int index); public int getIndex(String uri, String localPart); public int getIndex(String qualifiedName); public String getType(String uri, String localName); public String getType(String qualifiedName); public String ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.