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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.