[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Michael Kay" <M.H.Kay@e...>
  • To: "xml-dev Mailing List" <xml-dev@i...>
  • 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@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member