[
Lists Home |
Date Index |
Thread Index
]
- From: "Michael Kay" <M.H.Kay@eng.icl.co.uk>
- To: "xml-dev Mailing List" <xml-dev@ic.ac.uk>
- Date: 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
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|