XMLStreamWriter - ability to stream a CDATA section?
Jaikiran Pai
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[1] 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
for(....) {
// 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?
[1]
https://docs.oracle.com/javase/7/docs/api/javax/xml/stream/XMLStreamWriter.html#writeCData(java.lang.String)
-Jaikiran
More information about the jdk-dev
mailing list