c++ - XML - SelectNodes - 如何获取具有某些值的属性的节点 (MFC)

标签 c++ xml visual-c++ mfc msxml

我在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/

相关文章:

c++ - 使用随机访问迭代器调用模板函数

c++ - 数字生成 C++

java - Android - 更改所有 Android 版本的应用程序语言

xml - 如何在 XSLT 中对元素进行分组

java - 在 Android 中重复写入 XML 文件的最有效方法是什么?

c++ - 在 VC++ 11 中使用别名声明

c++ 派生函数未被调用

c++ - 使用 mingw730 32 位的 Qt 5.12 项目发布构建中代码位置的偏移量

c++ - 我们还需要做静态分析吗?

c++ - 如何修复警告 : extended initializer lists?