Friday, 27 February 2015

XPath - get element depending on its sub-element



I'm new to XPath, and using it in Java to fetch some data from website. Maybe you could help me or advice me what to use to accomplish what I want.



<a title="Person" href="some link">
<name>John</name>
</a>
<a title="Person" href "some OTHER link">
<name>Wayne</name>
</a>


How to get some attribute value of element depending on its sub-element?


For example, I need href value of element that has sub-element with value John, how to do that?


Thanks


No comments:

Post a Comment