I agree. We should have an interface specifically for Attributes and
implementations of Map and Dictonary on top of that.
> I
> agree that Dictionary is far less than ideal -- what do you imagine
> the attributes interface looking like?
/**
* An XmlAttributeSet is a set of named attributes each
* with a string value.
* Both specified and defaulted values are included
* and are not distinguished.
* Implied attributes are not included.
* The XML processor is free to modify the AttributeSet after the
* application returns from startElement.
* The application can use clone to make a copy of the AttributeSet
* which will not be modified by the XML processor.
*/
public interface XmlAttributeSet extends Cloneable {
/**
* Return the value of the attribute with this name, or null is the
* set does not include an attribute.
*/
String get(String name);
/**
* Return the number of attributes in the set.
*/
int getSize();
/**
* Get the name of the i-th attribute, where i is greater than or
* equal to 0 and less than the number of attributes in the set.
* The order of the attributes is not defined.
*/
String getName(int i);
/**
* Get the value of the i-th attribute, where i is greater than or
* equal to 0 and less than the number of attributes in the set.
*/
String getValue(int i);
}
You could use an Iterator or Enumeration instead of
getSize/getName/getValue, but I think it would probably be more
complicated and less efficient.
James