我想找出XML代码的XPath查询,其中元素即city
要检查条件(是否等于例如。'New York')是嵌套的,而所需的元素即bprice
没有嵌套。
下面是XML代码:
<book>
<btitle>The Inferno</btitle>
<bprice currency = "dollars">19.99</bprice>
<bdate>2013-05-14</bdate>
<authorinfo>
<lastname>Brown</lastname>
<midname>G.</midname>
<firstname>Dan</firstname>
</authorinfo>
<publisherinfo>
<publishername>Doubleday</publishername>
<street>1745 Broadway</street>
<city>New York</city>
<zip>11119</zip>
<country>USA</country>
</publisherinfo>
</book>
这个XPath,
/book[publisherinfo/city = 'New York']/bprice
将根据请求选择publisherinfo/city
元素的字符串值为"New York"
的book
元素中的bprice
元素。