Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

search elements of a node using entered value

 
pourush rohila
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to create a prog to search a element from a node and all its siblings e.g.
i am having this xml file



i want to search value "jdbc:odbc:Mydata" and if user enter this value than i want to access all other elements form this node.
like
name, username, password

thnks in advance
 
Paul Clapham
Sheriff
Pie
Posts: 20202
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you're asking for suggestions about how to do it, I would suggest first parsing the document into a DOM, then using an XPath expression which selects the <Database> elements which are parents of the <name> elements which contain the chosen text. Then access those elements' children as required.
 
pourush rohila
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks paul i read the xpath tutorial on w3 and use xpath and by using preceding sibling i get the values but i want specific node but it gives all siblings from all node not from selected node can you give me any example. because there is no method or idea to get node using value
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic