Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] CDATA handling

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: Laurent Bihanic <laurent.bihanic AT atosorigin.com>, XOM-interest <XOM-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] CDATA handling
  • Date: Thu, 19 Sep 2002 10:24:14 -0400

At 10:33 AM +0200 9/19/02, Laurent Bihanic wrote:

- CDATA handling: There are cases where I need a tool to edit XML documents that are also edited manually. If a user used a CDATA section, I'd probably like to output the document with a CDATA section. Wouldn't Text.setCDATA(boolean) / isCDATA() be acceptable?

This one isn't going to happen. Implementation wise, it would rule out merging text nodes, something I'm still seriously considering. Much more importantly, it violates two XOM design principles:

1. Don't represent syntax sugar
2. Don't let the client do bad things.

The application of the first principle is obvious. The application of the second is based on my observation that lots of client code out there in the world today treats CDATA sections as some kind of special purpose container with structural significance rather than as just syntax sugar. I deliberately chose not to make this possible in XOM. I want to cause cognitive dissonance for developers using CDATA sections in this fashion so that they will reevaluate their approach and come to a better understanding of how they should and should not use CDATA.

--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+




Archive powered by MHonArc 2.6.24.

Top of Page