• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

XPath

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am newbie to XPath. I have the below file, to parse and retrieve the <jar> under <test> only and ignore <jar> under <subcomponent>. I am using XPath for the same.



The code,


When I retrieve, I am not getting the value. Please someone help me.

Thanks,
Ananth
 
Sheriff
Posts: 28326
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ananth Ram wrote:I am newbie to XPath. I have the below file, to parse and retrieve the <jar> under <test> only and ignore <jar> under <subcomponent>. I am using XPath for the same.


In that case you might want to consider finding out the difference between the "/" and "//" operators in XPath.

When I retrieve, I am not getting the value. Please someone help me.


Could you provide a description of the problem? "Not getting the value" doesn't mean anything when the first line of your post says you are expecting more than one value. So, tell us what you see, what you expected to see, and what the difference is.
 
Ananth Ram
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I tried both "\\" and "\". When I print on the console, I get to see only null.
But the iterations exactly match the <jar> under <test> only. But, how do I retrieve the value say 3, 4 or 8, 9.

Thanks,
Ananth
 
Paul Clapham
Sheriff
Posts: 28326
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ananth Ram wrote:Thanks, I tried both "\\" and "\".


Perhaps that's the problem. The backslash doesn't mean anything in XPath. You need slashes.

When I print on the console, I get to see only null.


Just the four characters "n" "u" "l" "l"?
 
Ananth Ram
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the four characters.

null.

Thanks, I am going over the XPath Expressions.
The expressions were not correct.

Able to retrieve the values from the same.


 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic