I’m trying to use xpath to return the value “Vancouver”, from either the comment or the text after it. Can anyone point me in the right direction?
The location li is always the first item but is not always present, and the number of list items after it varies for each item.
<item>
<title>
<description>
<!-- Comment #1 -->
<ul class="class1">
<li> <!-- ABC Location=Vancouver -->Location: Vancouver</li>
<li> <!-- More comments -->Text</li>
<li> text</li>
</ul>
</description>
</item>
This will pull it from the text after the comment:
This specifies the first
<li>inside the<ul>of class ‘class1’, only when it contains ‘Location:’, and takes the string after ‘Location:’. If you want to relax the requirement that it be the first li, use this: