Announcement: SAX 1998-01-12 Draft

Michael Kay M.H.Kay at
Wed Jan 14 12:37:39 GMT 1998

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

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list