File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes create xpath expression from xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "create xpath expression from xml" Watch "create xpath expression from xml" New topic
Author

create xpath expression from xml

Teena George
Ranch Hand

Joined: May 01, 2008
Posts: 82

Hello everyone,

Can we create an XPath expression from an XML document? my XML document is exactly like this:


I need to create an xpath which shows all of these nodes

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

XPath expressions don't show anything. They just select nodes. And the XPath expression to select all nodes in a document is this:
//*

Probably that wasn't what you had in mind, though. Could you rephrase your question so that you explain what you want to do?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
I think this example from the CodeBarn might help: http://faq.javaranch.com/java/SAXCreateXPath
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Ah... that would be an XPath expression for each of the nodes, not for all of them.
Teena George
Ranch Hand

Joined: May 01, 2008
Posts: 82
Thank you all.. Sorry, I got very late to reply.. the link was useful. However, i had got another way to reach my solution. It turned out that i do not need many of the things that come with the xml. So i created an XPath expression to pick up the things i wanted. then i created a parameterized string in the properties file to create the final result, which is again an xpath expression. This requirement was kind of really odd

Thank you

Teena
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: create xpath expression from xml