[jdom-interest] Question about ElementScanner
phil.weighill-smith at volantis.com
Sat Mar 26 13:22:24 PST 2005
Which then made me think: why not use XSLT instead?
From: Phil Weighill-Smith
Sent: Sat 26/03/2005 13:50
To: Michael Smith; jdom-interest at jdom.org
Subject: RE: [jdom-interest] Question about ElementScanner
Try using XPath to select all elements you want to replace then manipulate these elements via the JDOM API.
E.g. to find all elements called "x" anywhere in a document use the XPath "//x", or to find all elements called "x" with an attribute "a" with the value "example" you could use the XPath "//x[@a='example']". XPath is very powerful for performing potentially conditional selection of elements, attributes, text nodes etc. especially if you use the various axes and built-in functions.
From: Michael Smith [mailto:mikesmi at nc.rr.com]
Sent: Fri 25/03/2005 16:38
To: jdom-interest at jdom.org
Subject: [jdom-interest] Question about ElementScanner
I want to create a way to search through XML documents and perform a search and replace on certain elements regardless of their place in the hierarchy. I'm thinking ElementScanner is useful here? If so, can someone point me to an example of its use. If not, can you suggest another/better way?
More information about the jdom-interest