我在MFC工作
我想从 XML 中获取所有节点,属性具有一些值但值不应该为 null,如果没有属性则不应选择节点
<node att="sss"> - should be selected
<node att="sd342ss"> - should be selected
<node att=""> - empty value should not be selected
<node > - not having attribute should not be selected
如何为此创建 XPATH?
最佳答案
给定如下结构:
<root>
<node att="sss" />
<node att="sd342ss" />
<node att="" />
<node />
</root>
您的 XPath 仅选择具有属性且属性值不为空的节点,如下所示:
"//node[@att and string-length(@att) > 0]"
关于c++ - XML - SelectNodes - 如何获取具有某些值的属性的节点 (MFC),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14827061/