Hi All,
I am trying to embedd an xml response string as CData inside an XML tree. The main XML tree is not in my control to create or change. I just have a class object where i am just setting the content as String, where the string is my xml.

The problem is when the mail xml tree appears, the content of my xml ( RawProfile ) are not properly encoded.

Java Code:
<ns5:PotsdamCache xmlns:ns2="...">
			<ns5:Content>&lt;![CDATA[ & l t ; RawProfile & g t ; & l t ; ROWSET type = &quot;AllLinkedParents&quot;& g t ; & l t ; /ROWSET&gt;&lt;ROWSET type = &quot;AllParents&quot;&gt;&lt;ROWSET type = &quot;organization&quot;&gt;&lt;ROW type = &quot;Raw&quot;&gt;PotsdamInstanceReference ..]&lt;/ROW&gt;&lt;ROW type = &quot;Name&quot;&gt;&lt;/ROW&gt;&lt;ROW tot;&gt;1006565004&lt;/ROW&gt;&lt;ROW type = &quot;ot;&gt;6&lt;/ROW&gt;&lt;ROW type = &quot;ParentId&quot;&gt;0&lt;/ROW&gt;&lt;/ROWSET&gt;&lt;ROWSET...&lt;/RawProfile&gt;]]&gt;</ns5:Content></ns5:PotsdamCache>
You might not see the encode problem above, since this editor handles it, but i hope you got my point. I ma getting these & l t ; & g t ; signs.

I am simply doing the following

Java Code:
where my buildRawProfile method returns a string of my xml ..."<![CDATA[<RawProfile>"....."</RawProfile>]]>".

I also tried another aproach:

Java Code:
  Document doc = parseRawProfile(buildRawProfile(userInstance), false);

	// Add a CDATA section to the root element
	Element element = doc.getDocumentElement();
	CDATASection cdata = doc.createCDATASection(buildRawProfile(userInstance));


// Parses an XML file and returns a DOM document.
  // If validating is true, the contents is validated against the DTD
  // specified in the file.
  public Document parseRawProfile(String rawProfile, boolean validating) {
      try {
          // Create a builder factory
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

          // Create the builder and parse the file
          Document doc = factory.newDocumentBuilder().parse(rawProfile);
          return doc;
      } catch (SAXException e) {
          // A parsing error occurred; the xml input is not valid
    	  log.debug(" A parsing error occurred; the xml input is not valid ");
      } catch (ParserConfigurationException e) {
    	  log.debug(" A parsing configuration error occurred; the xml input is not valid ");
      } catch (IOException e) {
    	  log.debug(" A parsing IOException error occurred; the xml input is not valid ");
      return null;

But then got this error:
Java Code:
		<faultstring>javax.ejb.EJBTransactionRolledbackException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory</faultstring>

The last approach, i didn't like so may be if someone could give a simple solution to this encoding problem.