我想从以下标签中提取name属性值
<application
comments="Do not erase this one"
executable="run_CIET"
icon="default"
instances="1"
mode="1"
name="CIET"
order="10"
selection="1"
tool="y"
/>
根据以下示例,我可以轻松地获取基于模式值的name属性值
xpath Applications.xml '//applications/application[@mode='3']'/@name
但是如果我想要添加更多的条件,例如“当mode=X且application标签中不存在tool属性时,获取name属性值”,我们应该怎么做?我尝试过类似以下的代码:
xpath Applications.xml '//applications/application[@mode='3' and !@tool]'/@name
但它没有起作用。
我以前没有使用过XPath,现在发现很棘手。我在W3C的XPath帮助文档中搜索,但没有找到我想要的内容。请帮帮我。