I have a xml like
<root xmlns:ns1="http://foo">
<ns1:child1>Text</ns1:child1>
<ns1:child2>Number</ns1:child2>
</root>
现在我从不同的人那里得到这个,比如说第二个人用与之相同的结构给我发送了另一条消息。
<root xmlns:anotherNs="http://foo">
<anotherNs:child1>Another Text</anotherNs:child1>
<anotherNs:child2>Another Number</anotherNs:child2>
</root>
唯一的区别就是命名空间的名称。我如何使用一个XPath表达式来选择两个xml文档中child2的内容?
像 "/root/child2" 或者 "//child2" 这样的表达式没有起作用。