wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes Sample on how to work with  XPATH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Sample on how to work with  XPATH " Watch "Sample on how to work with  XPATH " New topic
Author

Sample on how to work with XPATH

Ravi Doddi
Greenhorn

Joined: Jan 08, 2008
Posts: 5
Hai....
I have a xml file and I want to parse specific element using XPATH.
Could anyone give an sample java code that could parse an xml through XPATH.
Thankyou.
Tushar Madhukar
Ranch Hand

Joined: May 03, 2006
Posts: 36
By "parsing" XML, I am assuming you want to query your DOM.

JDK 1.5 comes bundled with an XPath API (pl refer to package documentation of javax.xml.xpath). It is quite easy to use, with the Javadoc itself mentioning a working example.

Regards
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381

Here is the output of the embedded bash script when executed with Java 1.6 on windows with cygwin installed:


[ January 20, 2008: Message edited by: Siegfried Heintze ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sample on how to work with XPATH
 
Similar Threads
generic parser
XPATH - org.apache.xalan.xpath
can xpath parse regular html?
validate a xpath against XSD
parse xml