[jdom-interest] Newbie: Is there any way to extend JDOM model?

John L. Webber - jentro AG John.Webber at jentro.com
Mon Oct 9 04:03:42 PDT 2000


Jeffrey Porter wrote:
> 
> The product I'm working on keeps all its data in a tree structure, JDOM
> produces a tree like structure
> from the XML. I'd like to be able to set JDOM up to produce a tree with
> nodes that fix into my tree
> structure, this would require me extending 'Element' & 'Document'. But
> I can't do this since that would
> require me having to maintain JDOM code, which I don't want.
> Alternatively if 'Element' & 'Document'
> were interfaces I could fit them into my structure.
> 
> Is there any way/will there be to specify what classes 'Element' &
> 'Document' extend so that I & others
> could produce a structure to fix into our products model?

I solved a similar situation by writing a class that implements
MutableTreeNode (called ElementTreeNode, and giving it an Element as its
user object. I had to implement the various methods of MutableTreeNode,
but this was not so difficult. Somewhat harder was the custom TreeModel
populated with ElementTreeNodes, but there are plenty of resources out
there for dealing with custom tree models. If you have any questions,
Ill be happy to help!
John


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jentro AG
John L. Webber, Software Development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Peter-Henlein-Strasse 28-30, 85540 Haar/Munich, Germany
Tel.:  +49 89 462 385 0     (switchboard)
Tel.:  +49 89 462 385 38    (direct)
Fax:   +49 89 462 385 29
mailto:John.Webber at jentro.com
http://www.jentro.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the jdom-interest mailing list