Xml 使用xpath基于另一个元素值选择一个值
我想从下面的Xml 使用xpath基于另一个元素值选择一个值,xml,xpath,Xml,Xpath,我想从下面的XML中提取8,根据Shoe Size或MenShoesShoe Size使用XPATH 我尝试了一些变体,但只能选择单个值,即8 空白也引起了问题,有人能帮忙吗? 对于粗略,整个XML包含许多颜色和大小,因此我要查找所有的大小 <Entry> <Attributes> <Values> <values>Tan</values> <identifier>Tan<
XML
中提取8
,根据Shoe Size
或MenShoesShoe Size
使用XPATH
我尝试了一些变体,但只能选择单个值,即
8
空白也引起了问题,有人能帮忙吗?
对于粗略,整个
XML
包含许多颜色和大小,因此我要查找所有的大小
<Entry>
<Attributes>
<Values>
<values>Tan</values>
<identifier>Tan</identifier>
</Values>
<identifier>MenShoesColor</identifier>
<name>Color</name>
</Attributes>
<Attributes>
<Values>
<values>8</values>
<identifier>8</identifier>
</Values>
<identifier>MenShoesShoe Size</identifier>
<name>Shoe Size</name>
</Attributes>
</Entry>
棕褐色的
棕褐色的
门舒斯科洛尔
颜色
8.
8.
男式鞋尺码
鞋码
如果您想获取具有“男鞋鞋码”标识符或具有“鞋码”名称的值,则可以尝试以下方法(格式化为可读性):
我想这就是你要找的
//Entry/Attributes[identifier = 'MenShoesShoe Size' or name = 'Shoe Size' ]/Values/values/text()
//Entry/Attributes[identifier = 'MenShoesShoe Size' or name = 'Shoe Size' ]/Values/values/text()