Re: Announcement: SAX 1998-01-12 Draft
Michael Kay (M.H.Kay@eng.icl.co.uk)
Wed, 14 Jan 1998 12:38:00 -0000
James Clark wrote:
>AttributeMap seems way too complicated.
>
>... To get at all the attributes, I have first to create
>an Enumeration (an unnecessary allocation). Then for each attribute
>name: I have to make two non-final method calls (nextElement and
>hasMoreElements); I then have a cast (which must be checked) from Object
>to String; I then have to look the attribute up using getValue. Compare
>this to the simple interface I suggested:
>
>void startElement(String elementName, String[] attributeNames, String[]
>attributeValues, int nAttributes)
>
Counter-argument: in my first SAX application, I knew what attributes to
expect, so I was able to write:
public void startElement (String name, AttributeMap atts)
{
String id = atts.getValue("ID");
String ref = atts.getValue("REF");
....
}
This would be MUCH more clumsy with James' proposed interface!
Mike Kay