[jdom-interest] Question about ElementScanner

Phil Weighill-Smith phil.weighill-smith at volantis.com
Sat Mar 26 05:50:58 PST 2005


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.
 
Phil :n)

	-----Original Message----- 
	From: Michael Smith [mailto:mikesmi at nc.rr.com] 
	Sent: Fri 25/03/2005 16:38 
	To: jdom-interest at jdom.org 
	Cc: 
	Subject: [jdom-interest] Question about ElementScanner
	
	
	Hi there,
	 
	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?
	 
	Thanks,
	 
	Mike




More information about the jdom-interest mailing list