gpt4 book ai didi

xml - 使用 XPath 从孙子那里获取文本并包含函数

转载 作者:数据小太阳 更新时间:2023-10-29 02:29:25 25 4
gpt4 key购买 nike

我有以下 XML。

<section level="sect1">
<title>
<page num="1150"/>
<content-style font-style="bold">ORDER 62</content-style>
<content-style format="smallcaps">Costs</content-style>
</title>
</section>

这里我想检查 title 中是否有单词 ORDER

我试过了

contains(//section[1]/title[1]/content-style[1]/text(),'ORDER')

但在某些情况下,字符串 ORDER 可能在第二个内容样式中,或者在某些情况下可能在第三个中。

请告诉我找到它的通用方法。

谢谢

最佳答案

你想要

exists(//section[1]/title/content-style[contains(., 'ORDER')])

关于xml - 使用 XPath 从孙子那里获取文本并包含函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32522786/

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