[jdom-interest] CDATA sections?

Jason Hunter jhunter at acm.org
Sat Jun 3 12:44:22 PDT 2000

> I'm thinking in an specialized editor. All XML tags will be hidden and user
> entries will be stored in CDATA sections; most of the time there will be
> plain strings in those sections, but a jpeg image could be inserted in a
> CDATA section too.

XML files are text.  They don't hold binary data.  (CDATA stands for
Character data.)  If you want to store a JPEG you have to use something
like BASE64 encoding to make the binary data into text, and that makes
the decision between CDATA or not pretty unimportant.  You can wrap the
BASE64 text with CDATA, but you'll still need to walk through the data
being sure to escape any accidental appearance of the CDATA end sequence
characters.  No real difference.


More information about the jdom-interest mailing list