aspose file tools*
The moose likes XML and Related Technologies and the fly likes query on parent axis in xpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "query on parent axis in xpath" Watch "query on parent axis in xpath" New topic
Author

query on parent axis in xpath

Sudarshan Sreenivasan
Ranch Hand

Joined: Jun 28, 2007
Posts: 188

Hi my input xml



My xpath expression



Also tried



My expected result Hello elemet.

Actual Result No elements

Where am i going wrong ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18564
    
    8

So you started from your context node and looked for a child element whose name was Hello. Maybe you found that Hello element and maybe you didn't, depending on what your context node was. Then you looked for a parent of that node which was a Bye element. Presumably that Hello element isn't a child of any Bye element; it certainly isn't if that's your whole document.
Sudarshan Sreenivasan
Ranch Hand

Joined: Jun 28, 2007
Posts: 188

Thanks, I was reading the expression wrongly !

Yes that was my entire document



This returns to me what i need.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: query on parent axis in xpath