1
我的XML结构是这样,获取Xpath的节点值
<items>
<item>
<brand>
<id> 3 </id>
</brand>
<product>
<productType>Type 1</productType>
</product>
</item>
<item>
<brand>
<id> 4 </id>
</brand>
<product>
<productType>Type 2</productType>
</product>
</item>
</items>
我需要的产品类型值,如果用户提供了品牌标识。对于例如,如果用户输入品牌编号3,然后我需要返回的产品类型1型
我用XPath表达式
/items/item/brand[id = 3]/product/productType
但它不工作尝试。什么是正确的xpath表达式。