C#:XPath来选择包含一个子属性节点? [英] C#: XPath to select node with attribute containing a substring?
本文介绍了C#:XPath来选择包含一个子属性节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用XPath来选择其code含英国国家节点?
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>
感谢。
推荐答案
尝试包含()
XPath函数。
Try the contains()
XPath function.
是这样的:
/Country[fn:contains(@code, "UK")]
一个快速谷歌搜索变成了XPath的功能的详细信息:
<一href=\"http://www.w3schools.com/xpath/xpath_functions.asp\">http://www.w3schools.com/xpath/xpath_functions.asp
A quick Google search turns up details on XPath functions: http://www.w3schools.com/xpath/xpath_functions.asp
这篇关于C#:XPath来选择包含一个子属性节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文