2017-04-13 34 views
0

我在属性表达式中使用撇号字符时出现问题。 我试过',',但他们失败了。所以,现在我正在管理自己,将其定义为另一个属性,如下所述。如何在fn:concat-property表达式中使用撇号字符WSO2 ESB

<property value="'" name="apos" scope="default" type="STRING"/> 
<property description="xpathexpr" expression="fn:concat('$ctx:hotel-static-data-rs//jsonObject/rows[id=',$ctx:apos,'hotelbeds_v3-',$ctx:hotelcode,$ctx:apos,']/value')" name="xpathexpr" scope="default" type="STRING"/> 

<property description="hotel-static-data-element" expression="evaluate($ctx:xpathexpr)" name="hotel-static-data-element" scope="default" type="OM"/> 

我确定必须有更好的方法来处理这个问题。所以,如果有人有线索请更新。

  • WSO2 ESB版本:5.0.0
+0

您可以试试[1]。 [1] http://stackoverflow.com/questions/42862240/how-to-escape-apostrophe-in-wso2-property-xpath-expression –

+0

我也现在做它以同样的方式,vivekanathan。我在提问中提到过。我认为必须有更好的方式,而不是将其定义为常量。 – namalfernandolk

回答

2

尝试更换单引号字符如本例。

<property name="hotelContentExpr" 
        expression="fn:concat('//content[hotelcode=','&#34;',get-property('htlCode'),'&#34;',']')" 
        scope="default" 
        type="STRING"/> 
+0

谢谢埃内斯托。但是这个&#34对于报价是正确的?不是为了使徒。 Apostophe是&#39; (参考资料:https://www.w3.org/MarkUp/html-spec/html-spec_13.html,http://www.degraeve.com/reference/specialcharacters.php,http://www.tedmontgomery.com /tutorial/HTMLchrc.html。) 但是也是不允许的。无论如何,当我添加引号时,我的表情也起作用。仍然在处理apostophe交叉。 :) – namalfernandolk