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表達式。