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.
这是 xml,不幸的是 XML 的任何内容都不可更改:
<allowance name ='' /> <allowance type ='' /> <allowance value='' />
而且我只需要在java中使用xpath获取“允许值”。怎么做到呢?
此表达式将返回所有具有 'value' 属性的 'allowance' 元素:
//allowance[@value]
这将只返回 "value" 的值:
//allowance[@value]/@value
你可以试试:/root//allowance[@value]