2017-04-13 36 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