我有以下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]]
答案 0 :(得分:2)
选择
之前存在相同单词的单词import tensorflow as tf
with tf.Session() as sess:
a = tf.constant(1, name="a")
b = tf.constant(2, name="b")
c = tf.add(a, b, name="c")
# prints 3
print(sess.run(c))
# prints 4 since we have fed a new value for a, for just this run.
print(sess.run(c, feed_dict={a:2}))
答案 1 :(得分:2)
使用following
轴:
//words/word[. = ./following::word]