[jdom-interest] CDATA sections in XMLOutputter
jhunter at collab.net
Wed Jun 21 16:02:50 PDT 2000
> My thinking is that as long as we're escaping &, <, and > (and we are)
> CDATA sections aren't a problem. When an element is passed to this
> method, it won't contain a CDATA section. If there was one in the
> original document it will have been resolved to pure text. Furthermore,
> by escaping < and > we won't accidentally get any illegal CDATA section
> delimiters in the output either. So I think we're fine as is. Do you
> concur? Can I take out this comment?
Right now there's no need to worry about CDATA section outputting.
I'm not sure if I made this public before, but I've been throwing around
the idea of a CdataString class that extended String and was a holder
for CDATA sections -- since some people expressed a fervent desire to be
able to preserve and construct CDATA sections. Having CdataString
extend String means you can treat it like a normal String, but the
outputter can behave intelligently, and you can explicitly construct a
CDATA section if desired. The downside is that CDATA blocks in the
middle of normal text blocks will appear as three elements to
getMixedContent() instead of one. We could have getContent() concat
them all together perhaps. Opinions?
More information about the jdom-interest