[jdom-interest] Re: Getting close with SAX...

James Strachan james at metastuff.com
Tue Nov 7 03:34:30 PST 2000

From: "Joseph Bowbeer" <jozart at csi.com>
> Comments and questions:
> Why would you make SAX more JDOM friendly rather than making JDOM more
> SAX friendly?

Sure, I think in practice it will have to be that way around really. I was
just thinking ahead a bit (with a lot of wishful thinking ;-) that if the
following were to happen...

* JDOM replaces DOM on the Java platform. On the Java platform DOM becomes
just another example of why language specific APIs are always cleaner and
nicer way to do things than cross language APIs

* JDOM ElementHandlers replace SAX on the Java platform for most developers
so SAX becomes a less used API used mostly by parsers

That it would be nice to tweak SAX a little (only the Attributes interface
really) to make parsing at the JDOM level more efficient.

Also it would mean then that SAX and JDOM would be the only core XML APIs
used on the Java platform so it would make sense to move them closer maybe?
Even if its just at the distribution level.

> Note that the Attributes in a SAX startElement event are immutable,
> whereas JDOM's Attribute is mutable, so some kind of conversion is
> required -- even if JDOM provided a SAX Attributes implementation.

Well spotted.

> However, if JDOM provided SAX Attributes implementation, then JDOM
> documents could be converted to SAX streams more efficiently.

I think this is a great idea - SAX providing some kind of AttributesBuilder
interface that JDOM could implement efficiently so we don't have to do the
extra conversion step.

Then at the JDOM level, we could have an AttributesList implementation that
(say) derives from ArrayList and implements the Atributes interface so we
remove redundancy in attribute parsing.

That will probably do I suppose ;-)

Whoever takes up the maintenance of SAX, its the first thing I'll be

Thanks for your input Joseph


James Strachan
email: james at metastuff.com
web: http://www.metastuff.com

If you are not the addressee of this confidential e-mail and any
attachments, please delete it and inform the sender; unauthorised
redistribution or publication is prohibited. Views expressed are those of
the author and do not necessarily represent those of Citria Limited.

More information about the jdom-interest mailing list