• Post Reply Bookmark Topic Watch Topic
  • New Topic

create xpath expression from xml  RSS feed

 
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: 22185
38
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: 42970
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: 22185
38
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!