cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with &

Former Member
0 Kudos

Hi All

I receive a string with a & from a 3rd Party. This seems to crash the mapping on XI.

The type is currently defined as a 'String', and works perfectly for all strings - just a problem when the string contains a '&'.

Thanks in advance

Clinton

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Good help from fellow XI'ers

stefan_grube
Active Contributor
0 Kudos

This was discussed already in this thread:

Regards

Stefan

udo_martens
Active Contributor
0 Kudos

Hi Clinton,

the received XML is not any longer well formed if including a "&". You need a CDATA element like:

<![CDATA[&]]>

, to pass it through a XML parser. For that reason you can put an not parsing ABAP mapping in front of the interface mapping, which will substitute the "&". Use FM ECATT_CONV_XSTRING_TO_STRING to have string, REPLACE the '&' and use FM ECATT_CONV_STRING_TO_XSTRING to have a XSTRING for the result. If your mapping is XSL you can use attribute <i>disable-output-escaping="yes"</i> of "<i>value-of</i>" to get the CDATA value.

Regards,

Udo

Former Member
0 Kudos

Hi

Thanks for all the replies I am looking at.

Udo, do you have some example of what you are explaining in your solution, I would like to try and see if I can get this implemented and working.

Thanks

Clinton

udo_martens
Active Contributor
0 Kudos

Hi Clinton,

you can achieve that by a java mapping (like stefan recommended) or by abap. Create a <a href="http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/frameset.htm">ABAP Mapping</a>, transform the source to string, replace

  REPLACE '&' WITH '<![CDATA[&' INTO mystring.]]>

and transform the result to Xstring. Be careful to replace only the right (better wrong) &. Transform with the FM i told you. Put the abap mapping in front of the if mapping. You can send the CDATA - if receiving application is pleasured or map it with XSL like i told you. To read the CDATA should be possible with any other mapping program (but i made it easy with XSL).

Regards,

Udo

Former Member
0 Kudos

Hi,

what is the problem?

roberti

Former Member
0 Kudos

Hi

The following XML is what I get from the 3rd Party.

=============================================

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

- <!-- Request Message Mapping

-->

- <MT_Metallurgical_Approval_Prcess xmlns="http://lonmin.co.za/MetallurgicalApprovalProcess" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

- <Process xmlns="">

<ProcessID>0</ProcessID>

<ProcessName>data</ProcessName>

<DataSetCategory>data</DataSetCategory>

<DataSetLogTime>data</DataSetLogTime>

<CurrentStageName>data</CurrentStageName>

<ViewURL><b>http://addres/PARS1/NoMenu.aspx?tab=7&procid=0&iindex=0</b></ViewURL>

<ClearFlag>true</ClearFlag>

</Process>

</MT_Metallurgical_Approval_Prcess>

============================================

The ViewURL that I receive crashes the mapping. If I change the ViewURL string to <ViewURL><b>http://addres/PARS1/NoMenu.aspx?tab=7procid=0iindex=0</b></ViewURL> this is the string without the '&'.

Hope this makes sense

Thanks

Clinton