function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhik DeyAbhik Dey 

XML and CDATA sections

I am working on CDATA section. My requirement is to add header and footer interms of CDATA to a string text node and then display the same.

I tried with the below code :

String eHeader ='<![CDATA[ <h1> PlaceHolder for Header </h1>  ]]>' ;
String efooter='<![CDATA[ <h1> PlaceHolder for Footer </h1>  ]]>';
XMLnode.fieldName =eHeader+'bdyText'+eFooter;
return my_node result;

After I execute the same in SOAP UI , i have getting the node value as :

<![CDATA[<![CDATA[ <h1> PlaceHolder for Header </h1>  ]]]]>><![CDATA[body21<![CDATA[ <h1> PlaceHolder for Footer </h1>  ]]]]>><![CDATA[]]>

Not understanding why i am receiving the empty cdata node as well and nothing being decripted like &lt; for the special characters.

Also when i tried the same with the below code

XMLnode.fieldName =eHeader+'bdyText';

In SOAP UI i am getting :

&lt;![CDATA[ &lt;h1> PlaceHolder for Header &lt;/h1>  ]]&gt;body21.

Could you please tell if both the result are correct? or the second one is right as in the first result i am not seeing nothing being decripted like &lt; for the special characters.

Any idea?
Abhik DeyAbhik Dey
Also paste any link related to CDATA XML in salesforce ? as i am new to CDATA hence require that