gpt4 book ai didi

xml - XPATH用于根据另一个元素的值检查xml元素的值

转载 作者:行者123 更新时间:2023-12-03 17:03:12 25 4
gpt4 key购买 nike

我的XML如下图所示。我想在// book // genre / text()='classic'时检查'number'的值,我想同时返回1000和1003。有人可以帮忙吗?

<list>
<book>
<author>
<name>John</name>
<number>1000</number>
</author>
<otherDetails>
<genre>classic</genre>
<price>$50</price>
</otherDetails>
<title>Dusk</title>
<isbn>dsdaassda</isbn>
</book>
<book>
<author>
<name>MARK</name>
<number>1001</number>
</author>
<otherDetails>
<genre>comedy</genre>
<price>$140</price>
</otherDetails>
<title>Midnight</title>
<isbn>dsdaassda</isbn>
</book>
<book>
<author>
<name>Pete</name>
<number>1003</number>
</author>
<otherDetails>
<genre>classic</genre>
<price>$140</price>
</otherDetails>
<title>Morning</title>
<isbn>EFGH</isbn>
</book>

最佳答案

/list/book[otherDetails/genre='classic']/author/number

关于xml - XPATH用于根据另一个元素的值检查xml元素的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33204446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com