Search code examples
xpathwso2carriage-returnwso2-esb

wso2 esb xpath substring-before special characters Carriage Return


In wso2 esb,proxy service, I am trying to get a string with xpath substring-before who extract 1 line stop by an Carriage Return (cr). here is my property.

<property name="str_id" expression="fn:substring-before(get-property('INPUT_MESSAGE'),'&#13;')"/>

When I save my proxy configuration from the web administration console, the carriage return character is replace by a white space. When I use an other editor like notepad, I have no problem, the carriage return is not replace. But the problem, if I restart the wso2 esb server, it replace it by an white space again.

Any idea of the problem ? Is that an bug?

Best regards, Nicolas


Solution

  • Carriage return will systematically be removed from your mediation's xml definition.

    One solution could be to import a text resource containing carriage return in ESB gov registry and use this resource in your xpath expression :

    • create a text file CR.txt with your text editor and insert a single character with ascii code 13 (use hexa view for exemple, don't just press 'return' or you may insert ascii code 10)
    • go to esb console, choose Browse under Registry, go to /_system/governance/trunk, choose Add resource and updload your file
    • change your xpath like this : <property name="str_id" expression="fn:substring-before(get-property('INPUT_MESSAGE'),syn:get-property('gov:trunk/CR.txt'))"/>