Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating XML CDATA section in Java ... What am I missing?

488001Feb 3 2006 — edited Feb 3 2006
I am creating XML on the fly in Java using the Oracle XML parser (in my jar xmlparserv2, a file named ".xdkjava_version_9.2.0.6.0_production" exists).

I have the following code:

(m_document is a class variable defined as type "Document")

Element addCDATANode(Node p_nodeParent, String p_nodeName, String p_nodeValue)
{
Element e = m_document.createElement(p_elementName);
p_nodeParent.appendChild(e);
CDATASection cds = m_document.createCDATASection(p_nodeValue);
e.appendChild(cds);
return e;
}

This is appending the data to the node, but it is missing the CDATA delimiters. This causes problems when imported back in, as the data is encoded and does not parse back into XML correctly.

Any assistance is greatly appreciated.

Thanks!
Steve Weber
Metavante Corporation
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2006
Added on Feb 3 2006
1 comment
2,878 views