[jdom-interest] CDATA as Text subclass?

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon May 28 09:46:19 PDT 2001

> By the way, does this mean that CDATA will become a
> marker subclass of Text. Seems like a good idea as they are
> the same except when outputting.
> On the other hand one will have to take care when testing for
> types if one need to divide between them as:
> if( obj instanceof Text ){...1...}
> else if( obj instanceof CDATA ) {...2...}
> always will go to block 1.

I am kind of leaning to the earlier proposal of boolean isCDATA().  Unless
there is a large number of use cases where cdata will be treated differently
than normal text, doing it this way would eliminate the need to special case
and/or build separate node type classes for exactly the reason this Text
class is being built.  My assumption is that most of the time, you would
treat them exactly the same and wouldn't want to bother to test for class.  

Since I don't use CDATA much, thoughts?

More information about the jdom-interest mailing list