Attribute lists

When a parser informs the application that an element start-tag has been encountered, it calls the startElement method, as described above. However, a start-tag may contain one or more attributes. It would not be possible to pass details of each attribute as individual parameters, because it is unknown in advance how many there could be. There is no theoretical limit to the number of attributes an element can contain.

The solution is for the parser to create a 'wrapper' object for all attribute details. This object must implement the AttributeList interface, which defines the following methods:

 int getLength(); String getName(int i); String getType(int i); String getType(String name); String getValue(int i); String getValue(String ...

Get XML Companion, The, Third Edition 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.