[jdom-interest] CDATA sections?
    Kevin Regan 
    kevinr at valicert.com
       
    Fri Jun  2 11:08:19 PDT 2000
    
    
  
>
> > System.out.println( "<FOO><![CDATA[<BAR>This is CDATA</BAR>]]></FOO>"
> );
> > 
> > With JDOM, it makes alot of sense to build a JDOM tree to
> > create the output document.  The above would not be possible
> > with the current implementation.
> 
> No. It would be easier.
> 
> Element myElement = new Element("FOO");
> myElement.setConent("<BAR>This is CDATA</BAR>");
> 
> Why make them create a CDATA? Our Outputter takes care of this for you.
> 
> -Brett
> 
I'm not sure if you are arguing seriously with me here. :-)
My argument is for someone that wants to create a CDATA section.
Your example does not do that.
Take the following (better) example:
-- Attempting to include the text "<Markup>" in
a FOO element.
This can be output to "equivalent" ways:
<FOO><Markup></FOO>
and
<FOO><![CDATA[<Markup>]]></FOO>
The user really should have a choice as to which format
he wants to use.  Example: For a large HTML segment, it will be
much more efficient, and much more aesthetically pleasing
to use a CDATA section, rather than escaping the entire
segment.
--Kevin
    
    
More information about the jdom-interest
mailing list