XMLStreamWriter - ability to stream a CDATA section?
jai.forums2013 at gmail.com
Fri Feb 16 13:08:43 UTC 2018
I'm looking for some information regarding the APIs on
javax.xml.stream.XMLStreamWriter which allows streaming of XML content
to a target output. Most of the APIs on it allow for streaming the
content out. However, there's the writeCData API which takes a String
object as a param and writes out the content as one whole CDATA section.
I don't see a way where I can avoid loading the entire content, which in
some cases can be large, in memory.
Is there a reason why such a construct hasn't been made available for
writing out CDATA? Something like:
writeStartCData() - starts a CDATA section
// incrementally write out the CDATA content
writeCData(char, off, len) // or something similar
writeEndCData() - ends a CDATA section that was previous started
Would it make sense to add such an API to that class?
More information about the jdk-dev