cancel
Showing results for 
Search instead for 
Did you mean: 

How to use CDATA

Former Member
0 Kudos

Hi ALL,

In one of my interfaces i am receiveing small boxes in the text field from SAP. It's coming in the string field, however the mapping fails due to XML parser error. After I remove it, mapping passes successfully. Process team needs that boxes to be passed on to the receiver end.

Someone suggested we could you CDATA to pass such characters. Could sometell me how to use and where to use CDATA?

Regards,

XIer

Accepted Solutions (0)

Answers (1)

Answers (1)

VijayKonam
Active Contributor
0 Kudos

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

VJ

Former Member
0 Kudos

Can't i use CDATA at field level in graphical mapping somehow???

XIer

Former Member
0 Kudos

anybody got an answer for this???

Former Member
Former Member
0 Kudos

Hey!

Some say you can use CDATA in graphical mapping, but for me the solution was to develop a stylesheet to put my values in CDATA elements.

Let's say your XML element <ServiceProviderName> needs to be in CDATA element, do like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<Message>
			<ServiceProviderName>
				<xsl:if test="Message/Response/FromInfo/ServiceProvider/ServiceProviderName != ''">
					<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]>
					<xsl:value-of select="Message/Response/FromInfo/ServiceProvider/ServiceProviderName"/>
					<xsl:text disable-output-escaping="yes"><![CDATA[]]]]>
					<xsl:text disable-output-escaping="yes"><![CDATA[>]]>
				</xsl:if>
			</ServiceProviderName>
		</Message>
	</xsl:template>
</xsl:stylesheet>

If field has the value <ServiceProviderName>this is a test</ServiceProviderName> the result will be:

<ServiceProviderName><![CDATA[ this is a test ]]></ServiceProviderName>

Develop the stylesheet in f.ex XMLSpy (or only a textpad), and import it as ImportArchive in Repository.

The problem with this is that it inserts CDATA elements after the graphical mapping which means your mapping will probably fail.

I'm not sure what you mean by "small boxes", but sometimes "returns" are displayed as small boxes in the monitoring (if you take "view source" on your message). To make these boxes disappear, you can create an ABAP mapping and use the Function Module SCP_REPLACE_STRANGE_CHARS to remove this. It seems that you want these boxes to remain, maybe you can explain why these boxes should follow the message?

regards Ole Mugaas

Former Member
0 Kudos

Thanks for your reply,

Yes my scenario is from SAP(Proxy) to Database(JDBC). The data in SAP came from a conversion run, and during conversion run some of the charaters like '==>' was stored in SAP as '&#9633;&#9633;&#9633;&#9633;' . So when the interface is run from SAP '&#9633;&#9633;&#9633;&#9633;' also comes along. and the mapping fails giving the error 'XML Parser Exception'. Process teams wants us to transmit the data the way it is in SAP, even if it contains special charaters.

So please advice me what to do.

The special charaters are coming only in one description field.

I have never used ABAP Mapping before, how do i go about doing it. If this is required.

Can't I do this in Graphical mapping, cause it's for only one field.

Regards,

XIer