cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Cdata to xml

Piyush
New Contributor III

Ho wcan I pass CDATA to SOAP execute

3 REPLIES 3

Kulashekharan
New Contributor II

Did you figure out a way?

tk421_cogenics
New Contributor II

Seriously, is there a solution to this issue?

In both SOAP Execute and XML Generator when I declare a CDATA section, it gets ignored and the string that is supposed to be in the CDATA section gets escaped.

The system to which I am sending data is not decoding the data and accepting "Franks&Beans" literally instead of “Franks&Beans”.

bgoodkinTCF
New Contributor II

Still looking for an answer here, although I found a workaround.

In my generator, I want to pass my input document wrapped in a CDATA tag because my InputDocument is an externally-provided XML containing its own XML declaration and I want to preserve it as-is.

Example "InputObject":

<?xml version="1.0" encoding="UTF-8"?><root>MyInputObject</root>

Input (from my XML Generator):

 

<InputDocument><![CDATA[$InputObject]]></InputDocument>

 

Output:

 

<InputDocument>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;root&gt;MyInputObject&lt;/root&gt;</InputDocument>

The only workaround I've found is to put the following in my XML Generator, then use .replace() in a Mapper:

Input:

<InputDocument>_INPUTDOCUMENTPLACEHOLDER_</InputDocument>

 

Replace:

$xml.replace("_INPUTDOCUMENTPLACEHOLDER_","<![CDATA["+$original.InputObject+"]]>")​

 Output:

<InputDocument><![CDATA[<?xml version="1.0" encoding="UTF-8"?><root>MyInputObject</root>]]></InputDocument>