[jdom-interest] CDATA sections in XMLOutputter

Brett McLaughlin brett.mclaughlin at lutris.com
Wed Jun 21 11:22:30 PDT 2000


Elliotte Rusty Harold wrote:
> 
> Brett,
> 
> You put the following comment in the printElement() method when what
> you're printing is the string content of an element:
>    /*
>     * XXX: We handle the 5 XML 1.0 entities
>     *   but what about CDATA? (brett)
>     */
> 
> 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?

Yup, and yup. Either it's a normal element, or if we ever add CDATA in,
then a CDATA, so either way, we're covered.

> 
> --
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |               Java I/O (O'Reilly & Associates, 1999)               |
> |            http://metalab.unc.edu/javafaq/books/javaio/            |
> |   http://www.amazon.com/exec/obidos/ISBN=1565924851/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
> |  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org



More information about the jdom-interest mailing list