我正在尝试在 Mule 中的 XPath 表达式下运行。它一个接一个地给我错误。有人可以帮我纠正这些 Mule XPath 表达式:
<xm:namespace-manager includeConfigNamespaces="true">
<xm:namespace prefix="acord" uri="ACORD.org/Standards/Life/2" />
<xm:namespace prefix="soap" uri="schemas.xmlsoap.org/soap/envelope/" />
</xm:namespace-manager>
<set-variable variableName="pwaHolding"
value="#[xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc = '37']/@OriginatingObjectID').value" />
<set-variable variableName="pwaPolNumber"
value="#[xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Holding[@id=$pwaHolding]/acord:Policy/acord:PolNumber').text]" />
尝试在 XPATH 表达式上方执行时出现异常:
Message :Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc == '37']/@OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: unexpected token: 37]
[Near : {... @tc == '37']/@OriginatingObjec ....}]
^
[Line: 1, Column: 96] (org.
mvel2.CompileException)
org.mvel2.compiler.ExpressionCompiler:247 (null)
2. Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc == '37']/@OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:211 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc == '37']/@OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String (org.mule.api.transformer.TransformerMessagingException)
org.mule.transformer.AbstractTransformer:123 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: unexpected token: 37]
[Near : {... @tc == '37']/@OriginatingObjec ....}] ^
[Line: 1, Column: 96]
at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:247)
at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:1944)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:862)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
嗨大卫,
我什至在替换后'
仍然"
出现以下错误:
消息:执行表达式“xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc == '37']/@OriginatingObjectID').value”失败。(org.mule.api.expression.ExpressionRuntimeException)。消息有效负载的类型:字符串 代码:MULE_ERROR--2 -------------------------------------------------- ------------------------------ 异常堆栈是: 1. [错误:意外令牌:37] [附近:{... @tc == '37']/@OriginatingObjec ....}] ^ [行:1,列:96](org.mvel2.CompileException) org.mvel2.compiler.ExpressionCompiler:247(空) 2. 表达式“xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc == '37']/@OriginatingObjectID').value”的执行失败。(org.mule.api.expression.ExpressionRuntimeException) org.mule.el.mvel.MVELExpressionLanguage:211 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html) 3. 表达式“xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/@tc == '37']/@OriginatingObjectID').value”的执行失败。(org.mule.api.expression.ExpressionRuntimeException)。消息负载的类型:字符串(org.mule.api.transformer.TransformerMessagingException) org.mule.transformer.AbstractTransformer:123 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html)
我有第二个 XPATH 表达式有问题,它也失败了。请帮助我解决这个问题