gpt4 book ai didi

xml - Xpath查找重复的节点值

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

我有以下 xml 文件:

<Dictionary>
<words>
<word>AM</word>
</words>
<words>
<word>AN</word>
</words>
<words>
<word>AN</word>
</words>
</Dictionary>

我需要 xpath 来查找重复的单词节点,例如上面的“AN”是重复的。我尝试从网络搜索中进行以下操作,但没有成功:

/*/*[index-of(/*/*/word(), word())[2]]

最佳答案

选择前面存在相同单词的单词

/Dictionary/words/word[.= ../preceding-sibling::words/word]

关于xml - Xpath查找重复的节点值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48120659/

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