Hello Murray,

The code you cited appears to be over four years old [1], so this doesn't 
sound like new behaviour. Regardless of when this was introduced, it isn't 
likely to change now. Both the HTMLSerializer and XHTMLSerializer were 
deprecated in Xerces 2.6.2. We've been encouraging users to migrate their 
code to use the standard JAXP Transformation API. If you're interested 
about the future of Xerces serializers see this post [2] to xalan-dev from 
February of this year.

[1] 
http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xml/serialize/HTMLSerializer.java?rev=1.10&view=markup
[2] http://marc.theaimsgroup.com/?l=xalan-dev&m=107593381313807&w=2

Murray Altheim <[EMAIL PROTECTED]> wrote on 09/03/2004 05:44:14 PM:

> Hi,
> 
> I searched the archives but was unable to locate any questions
> and answers on this subject, so my apologies if this has been
> covered before.
> 
> In one of the recent releases of Xerces-J, the XHTML serializer's
> behaviour was changed to always escape <script> and <style>
> elements' content using CDATA sections. While this is certainly
> permissable in XHTML (and recommended if the character content of
> the element contains problematic characters, see [1]), this
> behaviour is not always warranted or welcome. It seems that it
> should be an optional serialization behaviour, rather than
> hardwired in, or perhaps made sensitive to the specific character
> data content of the element to be serialized.
> 
> In revision $Revision: 1.26 $ $Date: 2004/02/16 05:24:55 $ of
> org.apache.xml.serializer.HTMLSerializer, on lines 395-404, and
> again on lines 623-632, there's an if statement that automatically
> tags <style> and <script> elements to be escaped as CDATA sections.
> 
>       if ( tagName.equalsIgnoreCase( "SCRIPT" ) ||
>             tagName.equalsIgnoreCase( "STYLE" ) ) {
>            if ( _xhtml ) {
>                // XHTML: Print contents as CDATA section
>                state.doCData = true;
>            } else {
>                // HTML: Print contents unescaped
>                state.unescaped = true;
>            }
>        }
> 
> If just prior to *actually* performing the CDATA escaping, in
> characters(String) and characters(char[],int,int), the character
> data content were checked for the presence of '<' and '&'
> characters, then state.doCData could safely be set false.
> 
> Alternately, a boolean option could be provided to turn off the
> default behaviour, though this latter suggestion does have the
> downside of potentially creating invalid serializations.
> 
> Because these CDATA sections are actually causing problems for
> my own project, I've had to disable the setting of state.doCData
> and just avoid invalid characters in my script and style elements.
> Obviously this is a less than adequate solution, and I'm just
> wondering if others have run across this.
> 
> Thanks,
> 
> Murray
> 
> [1] http://www.w3.org/TR/xhtml1/#h-4.8
> ......................................................................
> Murray Altheim                    http://kmi.open.ac.uk/people/murray/
> Knowledge Media Institute
> The Open University, Milton Keynes, Bucks, MK7 6AA, UK               .
> 
>    The North American Aerospace Defense Command had gone so far
>    as to develop exercises to counter the threat [of flying jets
>    into skyscrapers] and, according to a Defense Department memo-
>    randum unearthed by the commission, planned a drill in April
>    2001 that would have simulated a terrorist crash into the Pentagon.
>    http://www.sfgate.com/cgi-bin/article.cgi?
> file=/c/a/2004/07/25/MNG6S7SR421.DTL
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to