【发布时间】:2015-02-10 11:52:28
【问题描述】:
我正在尝试查找 xml 中每个元素的 xpath 并将其作为元素值。 我的源文件看起来像:
<root>
<parent1>
<child1></child1>
<child2></child2>
</parent1>
<parent2>
<child1></child1>
</parent2>
</root>
我想要这样的输出:
<root>
<parent1>
<child1> /root/parent1/child1 </child1>
<child2> /root/parent1/child2 </child2>
</parent1>
<parent2>
<child1> /root/parent2/child1 </child1>
</parent2>
</root>
我目前得到的输出为:
<root>
<parent1>
<child1> /root/parent1/child1 </child1>
<child2> /root/parent1/child2 </child2>
</parent1>"
<parent2>
<child1> /root/parent1/parent2/child1 </child1>
</parent2>
</root>
我无法正确遍历以找到 xpath。任何意见都是有价值的。
【问题讨论】:
-
显示代码,即使它是错误的,通常也是值得赞赏的..
标签: xml xpath xquery marklogic