【发布时间】:2015-01-03 00:49:23
【问题描述】:
我正在尝试使用 mule 中的表达式从 xml 读取数据,但出现以下异常:
java.lang.RuntimeException: org.mule.api.MuleRuntimeException: 无法评估 XPath 表达式:"//*[xpath:local-name()="oa:ID"]/text()"
流程如下
<flow name="testauditFlow1" doc:name="testauditFlow1">
<http:inbound-endpoint exchange-pattern="one-way"
host="localhost" port="8086" path="test" doc:name="HTTP"/>
doc:name="DOM to XML" />
<expression-component doc:name="Expression"><![CDATA[#[xpath('//*[xpath:local-name()="ID"]/text()').text]]]></expression-component>
<logger level="INFO" doc:name="Logger" />
</flow>
我使用的xml如下所示
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<_ord:ProcessOrder releaseID="9.0" versionID="7.0.0.0" xmlns:_ord="http://www.test.com/xmlns/test" xmlns:_wcf="http://www.test.com/xmlns/test/9" xmlns:oa="http://www.test.com/xmlns/test/foundation">
<oa:ApplicationArea xsi:type="_wcf:ApplicationAreaType">
<oa:CreationDateTime>2012-08-07T13:25:01.337Z</oa:CreationDateTime>
<oa:ID>1234566</oa:ID>
<_wcf:BusinessContext/>
</oa:ApplicationArea>
</_ord:ProcessOrder>
</soapenv:Body>
</soapenv:Envelope>
【问题讨论】:
-
你为什么在
local-name()函数上使用xpath:前缀?去掉前缀还能用吗?
标签: xml xpath mule xslt-2.0 esb