That�s probably normal behavior for XML parsers to prevent them from blowing up on humongous CDATA sections � which would explain why in StaX and DOM there is the setCoalescing method. See
Creating Parsers with JAXP and Referencing Enterprise Beans
void setCoalescing(boolean value) - If set, the parser combines all adjacent Text nodes and CDATA section nodes into a single Text node in the Document tree. If not set, CDATA sections may appear as separate nodes in the tree.
javax.xml.parsers.DocumentBuilderFactory javax.xml.stream.XMLInputFactory Of course this is only going to help you if you are using StAX or DOM and are going to use the CDATA as text right away.
Also read about that hiding HTML (and XML for that matter) in a CDATA section is discouraged:
The CDATASection Interface Alternately you could simply encode the XML as text; some products already include utilities for that purpose
BEA's com.bea.document.XMLUtils encodeXML(xmlData:String):String and decodeXML(encoded:String):String methods However it shouldn't be difficult to write your own.
[ February 10, 2006: Message edited by: Peer Reynders ]