Common event-based parser API

Mark L. Fussell fussellm at alumni.caltech.edu
Tue Dec 16 13:06:59 GMT 1997


On Tue, 16 Dec 1997, David Megginson wrote:

> events, so I'd like to propose this:
> 
> startElement(XmlParser p, String elname, java.util.Dictionary attributes)

Personally, it would save me allocating a collection to collect the ESIS 
style pre-element attributes for Aelfred, so that would be nice.  I am 
ultimately trying to call into a very similar interface:
  ObjectBuilder:
    Object createObjectFromName_parameters(String recipeName, 
                                           Map parameters);

Where the parameters are just a bit more general in type than attributes. 

A mild question would be: are you planning on being able to modify the
Dictionary after you have given it out, or can the client assume it is a
constant after the startElement? 
 
> Note the use of the Dictionary abstract base class here.  Hashtable is
> derived from Dictionary, as is my Trie class that I released a
> couple of years ago.  

Just a heads-up in case anyone doesn't know. In JDK 1.2, Hashtable is
obsolete: 
   NOTE: This class is obsolete. New implementations should implement
   the Map interface, rather than extending this class. 

The problem with Hashtable is that it is an abstract class instead of an
interface so although you can have different implementations they are
still pretty restricted in their implementation approach.  This has been a
known problem for a long-long time, and the 1.2 collections are finally
interface based.  The basic 'get', 'put' operations for Map are the same
though, so it is just a type-ing problem. 
    Not that this should weigh very heavily if you are trying to support
1.0 and 1.1 based browsers, but I suspect the 1.2 release will be migrated
to pretty rapidly (in the Spring->Summer). 

--Mark
mark.fussell at chimu.com


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




More information about the Xml-dev mailing list