You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bruno Dumon <br...@outerthought.org> on 2003/06/06 17:20:35 UTC

Re: What hacks are going on in Cocoon? (was: DO NOT REPLY [Bug 20508] - [PATCH] Namespace cleanup in HTMLSerializer)

On Fri, 2003-06-06 at 00:09, Joerg Heinicke wrote:
[...]
> Logging of element sax events:
> 
> startElement[
> uri: '', localName:'xhtml:div', raw:'xhtml:div']
> endElement[
> uri:'http://www.w3.org/1999/xhtml', localName:'div', raw:'xhtml:div']
> 

if these are corresponding start and end element events, then this is
obviously wrong.

> And using XSLTC:
> no exception.
> output:
[...]
> element sax events:
> 
> startElement[uri: '', localName: 'xhtml:test1', raw: 'xhtml:test1']
> endElement  [uri: '', localName: 'xhtml:test1', raw: 'xhtml:test1']
> startElement[uri: '', localName: 'ns0:test2',   raw: 'ns0:test2']
> endElement  [uri: '', localName: 'ns0:test2',   raw: 'ns0:test2']
> startElement[uri: '', localName: 'test3:test3', raw: 'test3:test3']
> endElement  [uri: '', localName: 'test3:test3', raw: 'test3:test3']
> startElement[uri: '', localName: 'xhtml:div',   raw: 'xhtml:div']
> endElement  [uri: '', localName: 'xhtml:div',   raw: 'xhtml:div']
> 

In a namespace-aware environment, this certainly isn't allowed either.
For more background see also
http://www.saxproject.org/?selected=namespaces

If you put the loggingtransformer right behind the xslt transformer,
then these are problems with xalan.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: What hacks are going on in Cocoon?

Posted by Joerg Heinicke <jo...@gmx.de>.
Bruno Dumon wrote:
 > If you have some time, could you compare the current behaviour with
 > that of xalan 2.5 and 2.4.1, to see if this got worse recently?

Hello Bruno,

back to these bugs - we stumbled over them in our company, where we use 
Cocoon 2.0.4 and updated Xalan to 2.4.1.

The pipe:

<map:match pattern="*.xbl">
   <map:generate src="{1}.xbl"/>
   <map:serialize type="xml"/>
</map:match>

The file:

<bindings xmlns="xbl-namespace-uri" xmlns:xbl="xbl-namespace-uri" 
xmlns:xul="xul-namespace-uri">
   <binding>
     <content>
       <xul:textbox xbl:inherits="class"/>
     </content>
   </binding>
</bindings>

The result (with Xalan 2.4.1):

<xbl:bindings xmlns="xbl-namespace-uri" xmlns:xbl="xbl-namespace-uri" 
xmlns:xul="xul-namespace-uri">
   <xbl:binding>
     <xbl:content>
       <xul:textbox xbl:inherits="class"/>
     </xbl:content>
   </binding>
</bindings>

While with old Xalan 2.2.D11 from JDK on every element the xbl 
namespace-prefix was added correctly (also on endElement). This can be 
seen still at http://conweb.virbus.de/conweb/binding/textbox.xml (using 
Mozilla; only if http://conweb.virbus.de/conweb/ shows still version 
2.1.12, the page will be updated probably tomorrow).

The solution here was simple: replacing generator + serializer by a 
reader. But I guess this is not always possible. Xalan 2.4.1 and up 
seems to have problems when the default namespace and a namespace-prefix 
are set to one namespace-uri.

Joerg


Re: What hacks are going on in Cocoon?

Posted by Bruno Dumon <br...@outerthought.org>.
On Sun, 2003-06-08 at 10:38, Joerg Heinicke wrote:
[...]
> 
> Not remembering the LogTransformer I did the logging in the 
> HTMLSerializer, but I get the same output using LogTransformer.
> And I saw XSLTC does not use any prefix mapping, but as you can see it 
> does neither use URIs. How is it propagating namespaces? Through 
> xmlns:xyz="anyUri" attributes? That's the only possibility I can imagine.
> But why does XSLTC use SAX in such a bad way? They completely ignore the 
> /SAX contract/. And why does SAX allow this?
> 

SAX doesn't prevent to generate malicious events.

I think the problems you highlighted here are also the cause of bug
20084.

If you have some time, could you compare the current behaviour with that
of xalan 2.5 and 2.4.1, to see if this got worse recently?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: What hacks are going on in Cocoon?

Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Bruno,

Bruno Dumon wrote:
>>startElement[
>>uri: '', localName:'xhtml:div', raw:'xhtml:div']
>>endElement[
>>uri:'http://www.w3.org/1999/xhtml', localName:'div', raw:'xhtml:div']
> 
> if these are corresponding start and end element events, then this is
> obviously wrong.

Yes, these are :-(

>>And using XSLTC:
>>startElement[uri: '', localName: 'xhtml:test1', raw: 'xhtml:test1']
>>endElement  [uri: '', localName: 'xhtml:test1', raw: 'xhtml:test1']
>>startElement[uri: '', localName: 'ns0:test2',   raw: 'ns0:test2']
>>endElement  [uri: '', localName: 'ns0:test2',   raw: 'ns0:test2']
>>startElement[uri: '', localName: 'test3:test3', raw: 'test3:test3']
>>endElement  [uri: '', localName: 'test3:test3', raw: 'test3:test3']
>>startElement[uri: '', localName: 'xhtml:div',   raw: 'xhtml:div']
>>endElement  [uri: '', localName: 'xhtml:div',   raw: 'xhtml:div']
> 
> In a namespace-aware environment, this certainly isn't allowed either.
> For more background see also
> http://www.saxproject.org/?selected=namespaces

Thanks for the link, I will read it today.

> If you put the loggingtransformer right behind the xslt transformer,
> then these are problems with xalan.

Not remembering the LogTransformer I did the logging in the 
HTMLSerializer, but I get the same output using LogTransformer.
And I saw XSLTC does not use any prefix mapping, but as you can see it 
does neither use URIs. How is it propagating namespaces? Through 
xmlns:xyz="anyUri" attributes? That's the only possibility I can imagine.
But why does XSLTC use SAX in such a bad way? They completely ignore the 
/SAX contract/. And why does SAX allow this?

Joerg