On Fri, Dec 11, 2009 at 7:18 PM, Jim Driscoll <Jim.Driscoll@sun.com> wrote:


On 12/11/09 3:45 PM, Dan Allen wrote:
Oh, I forgot one use case. Max was saying that they need to use CDATA in
their templates, but the CDATA should not be sent to the browser. So
there is the same problem with CDATA as with the XML declaration.

I commented directly on the bug, but here's my thoughts.

The CDATA case is actually considerably harder than the XML declaration.

Typically, you either want to serve the XML declaration application wide, or you don't.  Generally, because of IE, you don't.  I would argue that we should make that the default case.  If IE ever gets it's act together, or folks start using XML v2.0, then we can revisit the decision - that should last us for at least 5 years, anyway.

With CDATA, there will be times when you want to serve CDATA blocks to the browser (most notably, to wrap scripts).

Apparently, there will also be times when you don't (though the example of a custom script tag is not compelling to me - we handle that in Mojarra's implementation without incident, though it's a painful block of code to read).

There will therefore be times when you both want to serve CDATA blocks, and when you do not, possibly in the same page.

So just have a cdata tag.

<![CDATA[foo]]>  -- sent w/o CDATA (e.g., foo)
<h:cdata><![CDATA[foo]]></h:cdata> -- send wrapped as CDATA
<h:cdata>foo</h:cdata> -- sent wrapped as CDATA

This was solved in XSLT (if my memory is not failing me), so we are no different.

-Dan

--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://www.google.com/profiles/dan.j.allen