通过当前节点的 xmlnode 属性之一获取值
Posted
技术标签:
【中文标题】通过当前节点的 xmlnode 属性之一获取值【英文标题】:Get value through one of the xmlnode property for currentnode 【发布时间】:2016-11-08 12:14:59 【问题描述】:我当前的 xml 节点是:
<Item xsi:type="itm:Resource">
<ID>10</ID>
</Item>
我想阅读整个标签并搜索该标签中是否存在资源:
SelectSingleNode.OuterXml.Contains("Resource")
但是 Outer xml 正在考虑 Item 里面的所有标签,我只想要当前节点
尝试过其他属性,例如 name,value 确实只返回“Item”
【问题讨论】:
【参考方案1】:我的做法略有不同
SelectSingleNode("xPath").Attributes(0).Value.Contains("Resource")
希望这会有所帮助
【讨论】:
以上是关于通过当前节点的 xmlnode 属性之一获取值的主要内容,如果未能解决你的问题,请参考以下文章