我想选择不存在特定属性的节点。我试过 Not() 函数,但它不起作用。有办法吗?
示例:以下 Xpath 查询:
group/msg[not(@owner)]
应该检索第一个节点而不是第二个节点。但是,SketchPath(测试 Xpath 查询的工具)和我的 C# 代码都认为这两个节点都可以。
<group>
    <msg id="EVENTDATA_CCFLOADED_XMLCONTEXT"  numericId="14026"  translate="False"  topicId="302"  status="translated" >
        <text>Context</text>
        <comment></comment>
    </msg>
    <msg id="EVENTDATA_CCFLOADED_XMLCONTEXT_HELP"  numericId="14027"  translate="False"  topicId="302"  status="translated"  owner="EVENTDATA_CCFLOADED_XMLCONTEXT" >
        <text>Provides the new data displayed in the Object.</text>
        <comment></comment>
    </msg>
</group>
事实上 Not() 函数工作正常,只是我有其他条件和括号没有正确设置。人为错误。