1
我正在尝试在xml中找到每个元素的xpath并将其作为元素值进行提取。 我的源文件看起来像:MarkLogic:使用xquery获取元素的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。任何投入都是有价值的。
显示代码,即使它是错误的,通常赞赏.. – grtjn 2015-02-10 12:24:41