cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <jheini...@virbus.de>
Subject Re: AbstractTextSerializer.needsNamespacesAsAttributes
Date Wed, 01 Oct 2003 09:49:40 GMT
Hello Thomas,

as you can see in the Javadoc above the method this is a check method for 
namespace handling. I have not written that class and don't know whether 
this bit of code is part of the test, but I don't think so. It really looks 
like a bug.

If no one complains, I can apply the patch. If it should be already in 2.1.2 
I guess Carsten must apply it. Waiting for a reaction, applying and building 
the dist afterwards takes too much time, doesn't it?

Joerg

Thomas Bierhance wrote:
> Hi,
> 
>   I tried Cocoon 2.1 with the latest Resin Servlet Container.
> 
>   Problem:
> 
>     com.caucho.xml.QDOMException:
>       `null:' is an invalid XML name because the local name is empty.
>       XML names must be `prefix:name' or simply `name'.
>         at com.caucho.xml.QName.init(QName.java:102)
>         [...]
>         at com.caucho.xml.DOMBuilder.startElement(DOMBuilder.java:287)
>         at org.apache.cocoon.serialization.AbstractTextSerializer.needsNamespacesAsAttributes(AbstractTextSerializer.java:341)
> 
>   The current implementation does use an empty string as qualified
>   name and is missing a call to endElement():
> 
>     // Output a single element
>     handler.startDocument();
>     handler.startPrefixMapping(prefix, uri);
>     handler.startElement(uri, "element", "", new AttributesImpl());
>     handler.endPrefixMapping(prefix);
>     handler.endDocument();
>   
>   AbstractTextSerializer.needsNamespace could be changed as follows:
> 
>     String uri = "namespaceuri";
>     String prefix = "nsp";
>     String check = "xmlns:" + prefix + "='" + uri + "'";
>     String localName="element";
>     String qName= prefix+":"+localName;
>   
>     [...]
>   
>     // Output a single element
>     handler.startDocument();
>     handler.startPrefixMapping(prefix, uri);
>     handler.startElement(uri, localName, qName, new org.xml.sax.helpers.AttributesImpl());
>     handler.endElement(uri, localName, qName);
>     handler.endPrefixMapping(prefix);
>     handler.endDocument();
> 
>   I tried this code with the Resin Transformer and Xalan. It correctly
>   detects the two cases without errors.
>   
>   What do you think?
> 
> Regards,
>   Thomas

-- 
System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


Mime
View raw message