Adding Double quotes inside Reg-EX xpath evaluation

ParasofttoudayaParasofttoudaya Posts: 195
edited September 2017 in SOAtest

Hi Team,

I am trying to concat a json string with my json databank result
It supossed to be result as {"hashvalue":"hascontentFromXPath"}.

As i am not able to pass "(double quote) inside the reg-ex, i just passed single quote get the below result.
concat("{'hashvalue':" ,"'","hascontentFromXPath","'","}") ===> {'hashvalue':'hascontentFromXPath'}

is there any way to insert double quotes in it. ??

Note:
Below thready says i have to use backslash before double quote, its not working parasoft.
https://stackoverflow.com/questions/16761596/how-to-represent-the-double-quotes-character-in-regex

Comments

  • benken_parasoftbenken_parasoft Posts: 463 ✭✭✭

    In XPath, use two double quotes to escape a single double quote:
    concat("{""hashvalue"":""", /some/xpath/text(), """}")

  • OmarROmarR Posts: 205 admin
    edited September 2017

    IT may be easier to wrap each section in a single quote, like so:

    concat ( ' {"hashvalue": ' , ' " ', /root/pennywise[1]/text() , ' " ', ' } ')

  • Thanks OMAR, its working.

    I did tried ' " ', but inside two double quotes :(

Sign In or Register to comment.