OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: SAX: towards a solution

[ Lists Home | Date Index | Thread Index ]
  • From: James Clark <jjc@jclark.com>
  • To: David Megginson <ak117@freenet.carleton.ca>
  • Date: Sun, 04 Jan 1998 07:22:25 +0700

David Megginson wrote:

> Before we start, I am assuming that we will all accept the following
> three events without further discussion, since no one objected last
> time:
>   startElement (String name, java.util.Dictionary attributes)

I don't think using java.util.Dictionary is a good idea:

1. JDK 1.2 provides a new Map interface which replaces Dictionary.

2. java.util.Dictionary is an abstract base class not an interface.

3. java.util.dictionary is weakly typed: it doesn't enforce the
requirement that keys be strings, and it requires values to be cast to

I think it would be much better to have an Attributes interface and also
a convenience adapter class that provides a Dictionary implementation in
terms of that interface.

>   endElement (String name)

No problem with that.

>   charData (char ch[], int length)

I think there should be an offset argument as well.  Most of the Java
String operations that operate on a subarray take 3 arguments: char
array, offset and count.

If you don't have the offset argument you will be requiring some
implementations to do additional copying which has a significant
performance cost.

> I am also assuming that we will provide not only a callback interface,
> but also an (optional) base class with stub methods that implementors
> can override as needed; that means that novice users will not have to
> implement all of SAX, even if we do end up with nine or ten methods.

I agree we should provide these. JDK 1.1 does this extensively in AWT:
it calls the base classes Adapters.  I think we should follow this


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)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS