HI Ray, You can use a visitor to iterate through the document and hen you visit a node you can apply the Xpath.matches(currentNode).
You may have to do the remove as a separate path - I am not sure of the way that a visitor will behave is nodes are pruned from the list Miike SKells -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ray Grieselhuber Sent: Thursday 19 February 2004 23:40 To: [EMAIL PROTECTED] Subject: [dom4j-user] XPATH Comparison & wildcards I am attempting to iterate through an XML document and at each element, I want to compare my current position with an XPATH statement that may or may not match my current location. If it does not match, then I will delete the element, if it does, I will leave it untouched. Does dom4j provide functionality for this? The catch is that I will be comparing my current position with XPATH statements that have wildcards in them. Is this supported? So here is an example: <data> <person> <address>235 Somewhere</address> </person> <policy> <location> <address>123 Park Place</address> <location-name>Jones Place</location-name> </location> </policy> </data> The actual data is more complex than this, but basically even though they are in different places, the address element is the same everywhere it occurs, so I have XPATH statements defining this like: /data/person/address and /data/*/*/address Since I have an XPATH statement that will match both address elements (can I compare this in dom4j using wildcards?), I will keep the address elements, but delete the <location-name> element since it is not in my list of XPATH statements. Hopefully this makes sense. Any help would be appreciated. Ray Grieselhuber ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user