[jdom-interest] CDATA sections in XMLOutputter

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Jun 21 13:12:18 PDT 2000


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?

-- 
+-----------------------+------------------------+-------------------+
| 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/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list