cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable CDATA in xml

Former Member
0 Kudos

Hello,

We are using WebService (transaction in SAP MII). And if there are no data this webservice returns data like:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soap:Body>

      <XacuteResponse xmlns="http://www.sap.com/xMII">

         <Rowset>

            <Row>

               <outXML><![CDATA[&lt;Rowsets DateCreated=&quot;2015-02-17T13:59:36&quot;...]]></outXML>

            </Row>

         </Rowset>

      </XacuteResponse>

   </soap:Body>

</soap:Envelope>

And this causes problems in WebDynpro part. I guess with mapping. As it get used that if there are no data transaction should return

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soap:Body>

      <XacuteResponse xmlns="http://www.sap.com/xMII">

         <Rowset/>

      </XacuteResponse>

   </soap:Body>

</soap:Envelope>

So the question is how disable adding/generating of CDATA& Maybe there is some option or parameter at SAP Netweaver Server?

Regards,

Alex

Accepted Solutions (0)

Answers (2)

Answers (2)

iaki_vila
Active Contributor
0 Kudos

Hi Alexandr,

First of all, your source XML is bad generated. The usage of CDATA is not to interpret like XML syntax the content. Another way is to escape the symbols like <  ' with &lt; &quot; and so on. But you have the two ways done, you have escaped the content and to convert this content in text with CDATA.

You have this options:

1. Talk with the sender to have only one way to do it with CDATA or escape characters. Then this XSL cab be used:


<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">

        <xsl:value-of select="." disable-output-escaping="yes"/>

    </xsl:template>

</xsl:stylesheet>

2. If the sender can't change this output, You will need to deal with the escape characters with a java UDF that takes character to character and changing the escape value for the original. There are some examples in the SCN.

Hope this helps.

Regards.

former_member182412
Active Contributor
0 Kudos

Hi Alexandr,

Please check below thread.

XI: XML node into a string with graphical mapping?

/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

Moreover you can read this thread:

RFC : How to pass an entire xml node to a string

Please look into the reply of Henrique

Re: CDATA in xml file

Regards,

Praveen.