Xpath刷选出节点
以下xml为例
<AccountBook>
<Meals Total="2 />
<Clothes>hello</Clothes>
<HouseRent></HouseRent>
</AccountBook>
选出属性为Total的节点的Xpath:
//AccountBook/Meals[@Total="2"]
选出Clothes节点值为hello的Xpath:
//AccountBook/Clothes[text()="hello"]
选出HouseRent节点值为空的Xpath:
//AccountBook/HouseRent[not(text())]
或者是:
//AccountBook/HouseRent[not(node())]