Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 pugixml 库,我试图选择所有适合的节点:
//v6_root_object/v6_rootlist2d/obj_pluginobject[@level='0']
有一个由描述的子节点
//v6_root_object/v6_rootlist2d/obj_pluginobject[@level='0']/chunk[@id='110064']/string[@v='light']
有没有一种简单的方法可以在 xpath 中做到这一点?
您可以尝试这种方式:
//v6_root_object/v6_rootlist2d/obj_pluginobject [ @level='0' and chunk[@id='110064']/string[@v='light'] ]
只需在 XPath 条件(在 内)中添加子节点 XPath(相对于它的父节点[])。
[]