[jdom-interest] API Inertia

James Strachan james_strachan at yahoo.co.uk
Wed May 2 07:57:02 PDT 2001

> PS - Here's an attempt to show a simple Visitor example:

I'm hopelessy out of touch with whats going on these days with JDOM so
please forgive me if this post is totally off base. While eating my lunch
today I saw a few comments about the use of Node interfaces, polymorphism,
visitor pattern and the like on this list.

If, and its probably an *extremely* big if, people are considering the use
of interfaces, polymorphism, factories or visitors in JDOM at all, you might
find dom4j a useful reference to see how it tackled these issues. You can
download it, play around with it and see if there are any ideas you might
want to use in JDOM.


dom4j a project I started with similar goals to JDOM but I wanted it to be
based on interfaces, be polymorphic with fully integrated XPath support,
have plug-in factories and support event based processing so that it can
process massive documents easily and have API hooks for XML schema data

The full API is here


The main interfaces are here:-


The interface hierarchy is here:


In detail, here's a Node


It allows you to evaluate XPath expressions, get the XPath expression to
itself via getPath(), detach() itself from its parent, get its value as a
piece of XML text, write itself to a stream as XML and so on.

There's an interface Branch which extends Node which both Element and
Document implement such that you can modify the content of a document or
element in a polymorphic manner (accessing 'children' content).


Unfortunately I'm a bit maxed out until after JavaOne so if you've any
questions, please try contact me directly as I don't have time right now to
keep up with JDOM discussions. If my experience or ideas can be of any use
in your discussions by all means ask though.


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

More information about the jdom-interest mailing list