Hi Dave!
> I'm new to this list, so first I'd just like to say how nice dom4j looks!
> I've been trying to decide whether to use dom4j or JDOM on the
> project that I'm working on, and just I keep comming back to dom4j for
> it's clean and flexible design.
Cool - thanks!
> The one thing that I really liked was the so-called "pruning mode", which
> allows processing only elements that I'm interested in. I do have a
> question about this though...
>
> It appears that for any single parse, you can only specify a single path
> for which you'd like to prune elements. What would be nice, is if you
> could specify a set of paths to prune and associate each path with a
> different ElementHandler implementation. I've been able to do this, but
> with more hacking than I really wanted to. Let me explain...
You could do all this inside a single ElementHandler. i.e. do your own
pruning and event dispatching scheme via the ElementHandler.
SAXReader reader = new SAXReader();
reader.setElementHandler( new MyCompositeElementHandler() );
> In looking at the org.dom4j.io.SAXReader and
org.dom4j.io.SAXContentHandler
> classes it seemed that all I may need to do was extend the SAXReader class
> and override the createContentHandler method to create a SAXContentHandler
> which used my own custom ElementStack subclass.
Yes - I left that hook in as a possible extension mechanism. My hope was one
day to have some flexible, more powerful ElementStacks...
> I couldn't do this though,
> as
> the ElementStack class isn't public, so I can't extend it's functionality.
> Would it
> be possible to make this class public, to allow application level
> derivations?
I'm sold - sounds a great idea. So you're going to do a kind of
CompositeElementStack thing to fire multiple ElementHandlers? It might be
nice to add something like this into the dom4j API when we've experimented a
bit more. I've always wanted a path based listener support too...
I've made ElementStack and PruningElementStack public and made ElementStack
a property of SAXContentHandler. I'll have a think about adding some API
hook to SAXReader such that you can specify the ElementStack to use via a
property to save you deriving your own SAXReader / SAXContentHandler.
I've just changed the CVS repository, so if you take the latest CVS image
you'll be fine. I'll do the 0.3 release real soon now too.
Thanks for you input and kind words!
James
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-dev