Creating XML CDATA section in Java ... What am I missing?
488001Feb 3 2006 — edited Feb 3 2006I 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