You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2003/02/25 17:32:31 UTC

DO NOT REPLY [Bug 17378] New: - Xalan DOM to SAX namespace "bug" alternative fix.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17378>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17378

Xalan DOM to SAX namespace "bug" alternative fix.

           Summary: Xalan DOM to SAX namespace "bug" alternative fix.
           Product: Cocoon 2
           Version: Current CVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: core
        AssignedTo: cocoon-dev@xml.apache.org
        ReportedBy: bruno@outerthought.org
                CC: bruno@outerthought.org


As discussed in the following thread:
http://marc.theaimsgroup.com/?t=104592885400001&r=1&w=2
the current Cocoon CVS uses an identity XSL stylesheet before serializing, which
is suboptimal. This was introduced as a workaround for a "bug" in the Xalan
IdentityTransformer: if a DOM tree does not contain the necessary xmlns
attributes, the serializer will not add them.

After giving some more thought to this, I still think that it's not the
responsability of a standard IdentityTransformer to clean this up (maybe this
behaviour could be added when setting a special attribute or so).

As an alternative solution, I created a "NamespaceNormalizingDOMStreamer" class;
this class does the same thing as a normal DOMStreamer, and additionally
normalizes the namespace declarations (using the algorithm described in an
appendix of the DOM Level 3 spec).

I will attach patches that:
 * remove the usage of the xalanBugStylesheet in the serializers
 * change the usage of the DOMStreamer to NamespaceNormalizingDOMStreamer in the
 SourceWritingTransformer and the method XmlUtils.serializeNode.

Note that after applying this patch, problems might pop up with other
transformers or components that also relied on the ability of the serializer to
clean up the namespace mess. But hopefully this will not be the case ;-)
(samples were not working at the time of this writing, so it was difficult to do
much testing).

There are some other locations in Cocoon that use DOMStreamer and might be
better of using the NamespaceNormalizingDOMStreamer, though often it depends on
how they are used.