cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver - XML file...< instead of < and & instead of & coming in notepad

Former Member
0 Kudos

Dear Friends,

Interface output is an XML file CDATA tags are being used. In message mapping concatenation is being done to created CDATA tags.

XML file when seen in IE.

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

-<Jobs>

-<Job>

<JOBTITLE><![CDATA[test]]></JOBTITLE>

<REQNUMBER><![CDATA[50001336]]></REQNUMBER>

<COUNTRY><![CDATA[USA]]></COUNTRY>

<JOBLINK><![CDATA[http://saph2d01.vsp.com/sap/bc/erecruiting/posting_apply?param=http://sapa201.k2e.com/sap/bc/erecrui/post?param=cG9zdF9pbnN0X2d1aWQ9NEQ3MDE2RTE4MUImY2FuZF90eXBlPQ3...&sap-client=400]]></JOBLINK>

</Job>

-----XML file when seen notepad.

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

<Job>

<JOBTITLE>&lt;![CDATA[test]]&gt;</JOBTITLE>

<REQNUMBER>&lt;![CDATA[50001336]]&gt;</REQNUMBER>

<COUNTRY>&lt;![CDATA[USA]]&gt;</COUNTRY>

<JOBLINK>&lt;![CDATA[http://sapa201.k2e.com/sap/bc/erecrui/post?param=cG9zdF9pbnN0X2d1aWQ9NEQ3MDE2RTE4MUImY2FuZF90eXBlPQ3...&ampsap-client=400]]&gt;</JOBLINK>

</Job>

In notepad &lt instead of < and &amp instead of & is coming. Client is opening file in notepad and raised this concern.

Please advice on

-> Why notepad output is behaving like this?

-> What can be done in PI so that this conversion doesn't happen. & should come instead of &amp in notepad.

Thanks.

SM.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi,

Similar issue is discussed in this topic: . The conclusion is that you will probably have to use additional XSLT mapping to avoid the special characters being converted to escape sequences. You need to use the disable-output-escaping="yes" attibute, see more details here:

XSLT &amp;lt;xsl:text&amp;gt; Element

Regards,

Grzegorz

Answers (2)

Answers (2)

naveen_chichili
Active Contributor
0 Kudos

Dear Sumeet,

As replied by our friends you need to handle CDATA format in different way, better use XSLT mapping to handle special characters.

Thanks,

Naveen

engswee
Active Contributor
0 Kudos

Hi Sumeet

I think the engine behind PI's graphical mapping will automatically convert any XML special character to the equivalent value that is valid for XML.

As already mentioned by Grzegorz, the CDATA needs to be handled differently.

An alternative to XSLT would be a Java mapping. You can create correct CDATA sections using the DOM approach with the createCDATASection method. Following are some examples using this method.

Rgds

Eng Swee