Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create xpath expression from xml

 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this example from the CodeBarn might help: http://faq.javaranch.com/java/SAXCreateXPath
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah... that would be an XPath expression for each of the nodes, not for all of them.
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic