[jdom-interest] CDATA inconsistency

Malachi de AElfweald malachi at tremerechantry.com
Fri Nov 1 23:08:19 PST 2002

It would be against XML spec to check the characters within the CDATA, since the spec
says that CDATA is "unparsed character data". Seems like parsing it wouldn't fit the description, eh?


11/27/2002 8:30:32 AM, "Alex Rosen" <arosen at novell.com> wrote:

>It's a good question. We've debated about this - see the thread starting at 
>If it were free, then absolutely we'd check for it, but there would be significant costs to making 
sure that you can never do anything bad using JDOM. Having to check every character of the document 
(CDATA and plain text nodes, attribute values, element and attribute names, etc.) for well-formedness 
would be one of them. Some people think it's worth the trade-off, some don't.
>BTW you can absolutely fail a constructor nicely in Java - just throw an exception. C++ used to have 
this problem, but I think that adding exceptions fixed it.
>Alex Rosen
>Novell, Inc.
>>>> Duane Morin <dmorin at lear.morinfamily.com> 11/01/02 10:58AM >>>
>Is this the right behavior, is what I'm asking. I am allowed to create a
>CDATA with those illegal characters.  I assume that this is because 
>you can't real fail a constructor nicely in Java.  Should there be a way 
>that I can tell immediately that I've got bad characters on my hands?
>To control your jdom-interest membership:

More information about the jdom-interest mailing list