• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

XPATH Question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I query a xml document against an xpath (something like /Txn//Address) and it return a list of result nodes. Now I need to know each node and its complete xpath.
How do I get it?
 
Ranch Hand
Posts: 1241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately this is a bit tricky. For any given XML element, the chances are that there are several different XPaths to get there. As far as I know, the common XML parsers don't have methods for providing XPaths between two elements because of this - it just wouldn't know which XPath to give. It would be possible to write your own one though.....
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dave,

Am I missing something or are you saying there is no equivalent to

xsl:for-each



- m
 
Dave Lenton
Ranch Hand
Posts: 1241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Madhav Lakkapragada:
Dave,

Am I missing something or are you saying there is no equivalent to

xsl:for-each



- m



Hope not! I thought that Sam was asking for a method that takes an element and returns an XPath. Maybe I got the wrong end of the stick.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dave Lenton:


Hope not! I thought that Sam was asking for a method that takes an element and returns an XPath. Maybe I got the wrong end of the stick.



Umm...from what I understood, it takes an XPath (/Txn//Address) and returns a list of elements. Now, we want the XPath's for each of the Nodes in the list.

Maybe Sam or someone else could clarify.

- m
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic