[jdom-interest] DeclHandler interface

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon Oct 1 06:17:25 PDT 2001


> 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).

The version in CVS has implemented the declhandler to build a string
representation of the internal subset.  Perhaps you can use that?

> 
> 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?

Compared to simply subclassing Element and overriding toString, a wrapper
would be clumsy.  So, subclass Element ;-)



More information about the jdom-interest mailing list