Attributes

The Attributes interface replaces the AttributeList interface. Again, the principal reason for this new interface is to support namespaces.

The methods are largely the same as before, but note that getQName replaces getName, as element and attribute names are now called as they appear in tags (regardless of whether or not they include colons, and even then whether the colons are significant):

int     getLength();
String  getQName(int index);
String  getValue(int index);
String  getValue(String qName) ;
String  getType(int index);
String  getType(String qName);

The following new methods are equivalent to the ones above, but support namespaces. Attribute names, values and types can be found without knowing the prefix used in the document for ...

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.