2
我对XPath有点新手,所以我需要一些帮助来解决这个问题。我有这样的XML文件:在嵌套节点中获取唯一的XPath节点值
<items>
<item>
<brandName>Brand 1</brandName>
<productTypes>
<productType>Type 1</productType>
<productType>Type 3</productType>
</productTypes>
</item>
<item>
<brandName>Brand 1</brandName>
<productTypes>
<productType>Type 2</productType>
<productType>Type 3</productType>
</productTypes>
</item>
<item>
<brandName>Brand 2</brandName>
<productTypes>
<productType>Type 4</productType>
<productType>Type 5</productType>
</productTypes>
</item>
</items>
我试图找出一种方法来获取特定品牌的所有独特productType。例如,“品牌1”的所有唯一productType将输出“类型1”,“类型2”,“类型3”
我一直在使用Google,但没有多少运气。任何帮助,将不胜感激!
我不认为你可以在一个节点集XPath表达式进行独特的操作,你需要在任何一种语言,你使用的解析表达式一些额外的代码。 – jspboix