[jdom-interest] CDATA and Text

Noam Tamim noamt at yahoo.com
Sat Apr 6 23:07:15 PST 2002

--- cvs at jools.org wrote:
> Made it so "CDATA extends Text" so now you can look just for Text nodes
> in content and don't need to differentiate CDATA sections if you don't
> want to.  This does require "instanceof CDATA" to come before "instanceof
> Text" now.  Watch out for that subtle bug.

I really think this is the wrong way to go. There has been a proposal to
cancel the CDATA class, and add a flag to Text that determines if it's a
CDATA (i.e. text.isCDATA() and text.setCDATA(boolean)). IMHO it is a better
solution, because many programmer don't care about the type of the text.
Moreover, CDATA is just a matter of output, ain't it?

That bug you mentioned can be really hard to find. One will have to search
for all the times he used "instanceof CDATA" and "instanceof Text", and
possibly other thing. I might be tricky.
Cancelling the CDATA class, OTOH, will make the compiler find all those cases
for the programmer. 


Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax

More information about the jdom-interest mailing list