[jdom-interest] Adding a DocumentListener interface

Jason Hunter jhunter at collab.net
Tue Jul 25 01:26:15 PDT 2000

yt at sideshowbobproject.com wrote:
> I am also working on this project with Ken. We were thinking about writing a set of
> wrapper subclasses for the document/elements, but we were unsure of how to go about
> coercing the parser to create Element wrapper subclasses (in lieu of normal
> Elements) without changing the JDOM code. Is there something that we're not seeing?

An easy hack is to have a converter that converts from a normal JDOM
document to a special JDOM document (just like JDOM can convert from DOM
to JDOM, only easier to write).  A higher performance hack is to change
SAXBuilder to create your kind of elements.  A high performance elegant
solution is to change SAXBuilder to be pluggable for the kinds of
elements it creates, using something like an internal factory.  Off the
cuff I'd say you want an Element createElement(...) protected method
that a subclass of SAXBuilder can override to create subclasses of
Element, and so on for the other JDOM objects.


More information about the jdom-interest mailing list