Hey Franz
 
You could always try writing a SAX XMLFilter to filter out whatever you like using whatever matching patterns you can think of. Then you can install it as follows
 
XMLFilter filter = new MyFilter();
SAXReader reader = new SAXReader();
reader.setXMLFilter( filter );
...
 
Its on our TO DO list to allow XPath patterns to be used with the addHandler() method so that you could use an XPath expression like //foo or /*/bar or whatever - it shouldn't be too hard to do. The org.dom4j.rule package already does most of the necessary stuff already. If anyone fancies diving in and patching the code please go ahead - otherwise I'll try get around to it real soon.

James
----- Original Message -----
From: Franz Beil
Sent: Wednesday, February 20, 2002 11:32 AM
Subject: [dom4j-user] SAXReader.addHandler() path arg

Hi,
 
I need to skip elements with a particular name in a xml document and tried pruning them using SAXReader.addHandler(path, handler). It seems that the path argument can only be a unique path (e.g. /parent/child/grandchild) , no wildcards seem to be permitted (e.g. //child). Is this behaviour intended?
If yes, could anyone point out a solution to prune elements specified only by name anywhere in the tree on reading a xml document?
Also, I'm looking for a way to prune xml comments on reading a xml doc. Is there a way to make a SAXReader call back on org.xml.sax.ext.LexicalHandler methods?
 
Thanks a lot for any help,
Franz

Reply via email to