[jdom-interest] DeclHandler interface

Watson, John John.Watson at open-talk.co.uk
Mon Oct 1 04:38:46 PDT 2001

Hi - I've just taken my first look at JDOM, and I like the simplified
interface it has.  I'm investigating using it to develop a simple
DTD-directed XML editor, and I've run into a couple of problems.

Firstly, a bug.  SAXHandler implements DeclHandler (with empty method
bodies).  However it restricts this interface, because its methods do not
throw SAXException as they should.  I doubt if there's any reason to
restrict possible subclasses of SAXHandler in this way - I imagine it's just
an oversight.  (I want a subclass that both builds a JDOM tree and parses
the DTD).

Secondly a problem.  I'd like to use JDOM Elements as the model in an MVC
tree view using the Swing JTree class. This class builds trees from any
underlying model object, as long as this implements the toString() method.
Unfortunately, the Element class has an implemenation of toString that is
far too verbose for my needs - I just want the element name (probably
prefixed by the schema name) and nothing else.  I've got round this by
writing a wrapper for Element with it's toString method overridden, but this
is clumsy.  Any ideas about something a bit cleaner?


John Watson
-------------- next part --------------
This message is confidential and is intended for the addressee only; unless clearly 
stated that this disclaimer should not apply, this e-mail is not intended to create legally
 binding commitments on behalf of any company in the British Interactive Broadcasting 
Holding Limited group, nor do its contents reflect the corporate views or policies of any 
such company. Any unauthorised disclosure, use or dissemination, either whole or 
partial, is prohibited. If you are not the intended recipient of the message, please notify 
the sender immediately.

More information about the jdom-interest mailing list