Skip to Content

Creating CDATA sections in output XML

Hi XI/PI Experts

Hope you are able to help me out in this matter, as I´m starting to loose my hair over this problem 😊

I have a mapping from a ARTMAS04 idoc to a XML, which works fine. The problem is that the receiver application of the XML requires CDATA sections for two of the fields in the output structure.

If I just add the CDATA tags directly in my message mapping, XI will convert the output source such as the CDATA start "<![CDATA[", is represented as "&lt;![CDATA[". I guess this is because the fields are beeing represented as Strings.

To overcome this problem I created a JAVA mapping which takes the output from my MM and add CDATA sections to the two fields using the Dom4J class. The solution works fine when I am testing it in my Interface Mapping, but when I view the source on the XML in SXMB_MONI, it still looks like "&lt;![CDATA["

How can I keep the CDATA sections without XI translating them?

Any answer is appreciated.

Best regards


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 29, 2008 at 02:44 AM

    This UDF will help you...

    //write your code here

    StringBuffer result=new StringBuffer();

    char[] splChar= {'!','#','$','%','&','<','>'};

    int length=splChar.length;

    int splCharFound=0;

    int i;




    { splCharFound=1;

    break; // the control comes out even if ther is one Spl Charr



    if(splCharFound==1) //if the String contains Special Characters





    return result.toString();


    else //if the input doesnt contain any spl character


    return input;


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2010 at 09:33 AM

    Hi mates, this problem it's now solved, i forgot to xplain the solution. The solution has been a java function in the mapping to split each field whit the according data structure, if u need more info, please, contact whit this forum.

    Best regards and thanks.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi ,

      Will you please let me know what function did you use to replace encoded chanracters "&lt;".I dont find this in SXMB_MONI or chanel monitoing until unless i open with notepad or viewsource.I just used constant in my mapping and concat to achive the CDATA structure.Please let me know how did u fix this issue.I tried with intermediate mapping and UDF and replace string however in the mapping results when i open using 'src' button i can see &lt; but not with normal tabular tree view.Your suggestion will be appreciated.