【发布时间】:2015-01-08 01:10:04
【问题描述】:
您好我正在尝试使用 xpath /ns0:Start/ns0:Area/ns0:Test/ns0:Identifier/ns2:UniqueID 提取 UniqueID 的值,但它不起作用请帮助我,我需要正常的 xpath 以及MEL 命令
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Start xmlns:ns0="http://www.example.com/xmlns/9/Test">
<ns0:Area>
<ns0:Test>
<ns0:Identifier>
<ns2:UniqueID xmlns:ns2="http://www.example.com/xmlns/9/foundation">123456</ns2:UniqueID>
</ns0:Identifier>
</ns0:Test>
<ns0:Test>
<ns0:Identifier>
<ns2:ExternalOrderID xmlns:ns2="http://www.example.com/xmlns/9/foundation">external</ns2:ExternalOrderID>
</ns0:Identifier>
<ns0:Info>
<ns0:Status>st</ns0:Status>
</ns0:Info>
</ns0:Test>
</ns0:Area>
</ns0:Start>
【问题讨论】:
-
您需要告诉您的 XPath 代码您的前缀是什么意思 - 没有要求或假设 XPath 表达式中使用的前缀与 XML 文档中使用的前缀相同 - 即您可以使用
exf用于http://www.example.com/xmlns/9/foundation命名空间。 -
你能告诉我如何为此编写一个 xpath
-
我不熟悉你的工具,但我已经在在线测试器here 中放了一个例子 - 正如你所看到的,我故意使用不同的前缀来表明它们不问题 - 只有命名空间 URI 可以。
标签: xml xpath mule xslt-1.0 mule-studio