Maybe I read the code the wrong way. What I understood was:

   public void endElementImpl(String uri, String local, String qual) throws SAXException {
        if (XHTML1_NAMESPACE.equals(uri)) {
            if ((local.equalsIgnoreCase("textarea")) ||
                (local.equalsIgnoreCase("script")) ||
                (local.equalsIgnoreCase("style"))) {
                this.closeElement(false); // This line should cause the [<script] to become [<script>]
            } else if (local.equalsIgnoreCase("head")) {
        super.endElementImpl(uri, local, qual); // And thus this line should close the element with [</script>]

So my proposal would be to add a line like
(local.equalsIgnoreCase("div")) ||
for each element that should share this behaviour.

BTW, the source I am looking at is the one in Cocoon 2.1.7. I checked on
and the relevant part of the code is the same.


2005/8/2, Kees Broenink <>:

Adding to this is an issue with IE and the <script> tag. I did not
search the mail archive nor bugzilla, so maybe it is already addressed
for the next release.

The xhtml serializer will change
  <script type="text/javascript" src="/bxs/3_0_1/bpc/boot.js"></script>
  <script type="text/javascript" src="/bxs/3_0_1/bpc/boot.js"/>

This will break loading the JS in IE.


-----Oorspronkelijk bericht-----
Van: Antonio Fiol Bonnín []
Verzonden: Tuesday, August 02, 2005 11:26 AM
Onderwerp: Suggestion for XHTMLSerializer


I am finding a problem with empty elements when serving content with the
text/html content type on Firefox. For example, collapsed empty div
elements cause havoc in firefox. A possible workaround would be
implementing the compatibility guidelines indicated in the W3C

In particular, I would add the same check already present for style,
script and textarea for any element whose end tag is required in HTML

Would a patch for this be welcome?