bpel if条件xpath表达式

bpel if条件xpath表达式,xpath,soa,bpel,bpelxexec,Xpath,Soa,Bpel,Bpelxexec,请求xml为: <ABC> <ServiceCharacteristic> <Code>AAA</Code> <CharacteristicValue> <CharacteristicValue>2222</CharacteristicValue> </CharacteristicValue> </ServiceCharacteristic>

请求xml为:

<ABC>
 <ServiceCharacteristic>
     <Code>AAA</Code>
     <CharacteristicValue>
       <CharacteristicValue>2222</CharacteristicValue>
     </CharacteristicValue>
 </ServiceCharacteristic>

 <ServiceCharacteristic>
     <Code>BBB</Code>
     <CharacteristicValue>
       <CharacteristicValue>2223</CharacteristicValue>
     </CharacteristicValue>
 </ServiceCharacteristic>

 <ServiceCharacteristic>
     <Code>CCC</Code>
     <CharacteristicValue>
       <CharacteristicValue>2224</CharacteristicValue>
     </CharacteristicValue>
   </ServiceCharacteristic>
 <Account>
 --------
 </Account>

</ABC>


Need to put a BPEL if condition to check if there is ServiceCharacteristic with code   "CCC"
尝试了如下操作,但没有成功(错误(703):中不允许使用LocationPath表达式“self::node()/child::*[(local-name()=“Code”)]”,因为不存在隐式上下文节点):

**count($variable name/'*asterisk'[local-name()='ServiceCharacteristic' and     ./'*asterisk'[local-name()='Code']='CCC'] ) > 0**

请输入任何内容。.谢谢

我将问题中显示的XML脚本粘贴到XPath计算器中,以下表达式为我返回
true

count(/*[local-name() = 'ABC']/*[local-name() = 'ServiceCharacteristic']/*[local-name() = 'Code' and text() = 'CCC'])>0
在BPEL
if
中使用它可以如下所示:

 <if>
    <condition>count($Variable.ABCpart/*[local-name() = 'ABC']/*[local-name() = 'ServiceCharacteristic']/*[local-name() = 'Code' and text() = 'CCC'])>0</condition>
    <!-- remaining activities-->
 </if>

计数($Variable.ABCpart/*[local-name()='ABC']/*[local-name()='ServiceCharacteristic']/*[local-name()='Code'和text()='CCC'])>0

这假设您将XML存储在名为
variable
的变量和名为
ABCpart
messagePart
中。您必须根据您的设置对其进行调整,才能使表达式正常工作。

命令是:count($variable name/*[local-name()='ServiceCharacteristic'和./*[local-name()='Code']='CCC'])>0此部分无效XPath:/*[local-name()='Code']='CCC'?如果您想选择本地名称为'Code'且值为'CCC'的元素,请尝试以下方式:/*[local-name()='Code'和.='CCC']谢谢您的帮助,但在我将条件更改为:Count($variablename/*[local-name()='servicecomperic'和./*[local-name()='Code'和.='CCC']))>0编译器再次向我显示错误:错误(704):中不允许使用位置路径表达式“self::node()/child::*[((local-name()=“Code”)和(self::node()=“CCC”)]”,因为不存在隐式上下文节点。请尝试将/*[local-name()=“Code”和.='CCC']替换为子项:*[local-name()=“Code”和.='CCC']]谢谢,但还是出现了同样的错误。谢谢,但又没什么好运气了。。。只是为了检查我是否在任何地方出错,我的条件如下:$count($ExecuteRequest.parameter/ns8:CustomerOrder/ns8:CustomerOrderItem/ns8:Business//ns8:Product/ns8:customerFacingsService/*[local-name()='ServiceCharacteristic']/*[local-name()='Code'和text()='PortID']))>0 xpath中已经有用于抽象的“//”,这是bpel引发以下错误的原因:错误(702):中不允许使用LocationPath表达式“child::text()”,因为不存在隐式上下文节点。不,该错误毫无意义,因为没有显式的
child::text()
出现在表达式中。你真的确定这个错误是由这个表达式引起的,而不是这个过程的其他部分吗?此外,这不是BPEL的错误,所以可能是您使用的引擎中的错误?也许你应该在引擎开发人员的邮件列表上询问,他们可以知道更多。