Hi folks:
Could I use XPath to select country node whose code containing UK?
<country-list>
<Country code="TW,UK,MY" />
<Country code="US,CA,MX" />
<Country code="IN,PR,VI,IR" />
<Country code="Others" />
</country-list>
Thanks.
Hi folks:
Could I use XPath to select country node whose code containing UK?
<country-list>
<Country code="TW,UK,MY" />
<Country code="US,CA,MX" />
<Country code="IN,PR,VI,IR" />
<Country code="Others" />
</country-list>
Thanks.
You could use Linq to XML - just as an idea
Something like this:
var countryElement = from country in countryElement.GetAttribute("code") where country.Value.Contains("UK") select countryElement;
HTH robert.oh.
Try the contains()
XPath function.
Something like:
/Country[fn:contains(@code, "UK")]
A quick Google search turns up details on XPath functions: http://www.w3schools.com/xpath/xpath_functions.asp
Yes, do something like
//Country[contains(@code, 'UK')]
which selected the first Country element