Description of problem: I enter and save topic XML containing the following: <programlisting language="XML"> <![CDATA[<servlet-mapping> <servlet-name>javax.ws.rs.core.Application</servlet-name> <url-pattern>/hello/*</url-pattern> </servlet-mapping>]]> </programlisting> When I export the TopicXML for that topic, it exports like this: <programlisting language="XML"> <servlet-mapping> <servlet-name>javax.ws.rs.core.Application</servlet-name> <url-pattern>/hello/*</url-pattern> </servlet-mapping> </programlisting> Version-Release number of selected component (if applicable): How reproducible: Add the topicXML data as described above. Save the topic. Then export that topicXML. Steps to Reproduce: 1. Add the topicXML data as described above. 2. Then export that topicXML. 3. Actual results: Expected results: Additional info:
Many of my topics contain xml snippets. I am not able to edit those topics without messing up all the CDATAs until this bug is fixed. The topic displays fine, but it would be a maintenance nightmare to try to maintain the source code with < instead of CDATAs. Is there an option on the XML API to prevent converting CDATAs?
Fixed in 20110901-0957 Turns out this code: final DOMImplementationLS impl = (DOMImplementationLS)DOMImplementationRegistry.newInstance().getDOMImplementation("LS"); final LSParser builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null); final LSInput xmlFile = impl.createLSInput(); xmlFile.setByteStream(new ByteArrayInputStream(xml.getBytes(encoding))); final Document document = builder.parse(xmlFile); will coalesce CDATA elements. I couldn't find any way to disable it. Changed to this code: final DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = builderFactory.newDocumentBuilder(); final Document document = builder.parse(new ByteArrayInputStream(xml.getBytes(encoding)));
works as expected.