cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wirz <michael.w...@abs.de>
Subject Re: Error in org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer or xerces DocumentImpl
Date Fri, 25 Nov 2005 11:11:47 GMT

>On Tue, 2005-11-22 at 16:47 +0100, Michael Wirz wrote:
>  
>
>>Hello Coocon User Mailing List,
>>
>>During cocoon app development the following error arose using DOM-Documents
>>and the SAX-Streaming of cocoon. Since I am not sure if its a bug in cocoons
>>DOM->SAX Streamer or the Document Implementation of xerces I'd like to show
>>it to you first. Maybe you can help deciding if it is to be forwarded to
>>cocoon-dev
>>or another place.
>>
>>I built a DOM - Tree using the xerces DocumentImpl Documt-Class.
>>I then added a root Node with a Text Element, initialized (erratically)
>>with null.
>>see below:
>>
>>Document doc = new DocumentImpl();
>>Element e = doc.createelement("rootNode");
>>doc.appendChild(e);
>>e.appendChild(doc.createTextNode(null));
>>
>>This has been a valid DOM-Document and could be serialized using the
>>org.apache.xml.serialize.XMLSerializer and written to a file successfully.
>>
>>When using this DOM-Tree in an <xsp:expr> in cocoon a NullPointerException
>>occurred:
>>
>>Original Exception: java.lang.NullPointerException
>>	at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.dispatchChars(DOMStreamer.java:264)
>>	at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.startNode(DOMStreamer.java:471)
>>	at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.stream(DOMStreamer.java:229)
>>	at org.apache.cocoon.xml.dom.DOMStreamer.stream(DOMStreamer.java:150)
>>	at org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper.xspExpr(XSPObjectHelper.java:309)
>>	at ... the xsp-compiled java src ...
>>
>>I took a look at
>>*org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer.
>>dispatchChars looks like this:
>>
>>        private final void dispatchChars(Node node) throws SAXException {
>>            String data = ((Text) node).getData();
>>            contentHandler.characters(data.toCharArray(), 0, data.length());
>>        }
>>
>>If getData() yields null, subsequent calls will fail; resulting in my
>>NullPointerException.
>>
>>I fixed my DOM-Tree making things work.
>>Do we have to fix it in
>>**org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer?
>>Or is the DOM invalid according to the DOM Spec, in other words: is a
>>null-Data-Element allowed in a TextNode?
>>    
>>
>
>You could look it up yourself too :-) I just had a quick look at the DOM
>spec, but for me it is unclear whether it is allowed to be null or not.
>It is not mentioned that it cannot be null, but it is neither mentioned
>that it can be null, while other methods that do allow null values for
>arguments do mention this.
>  
>
Thanks Bruno, for your answer.
You encouraged me to have a look into the spec and -- I did it ;-))
I havent been looking in this document but it is much more easy to read
than i excpected...
I didnt find an answer as well: the data can be of zero length it is
stated there
but the technically possible null value is not mentioned. I could not
find any
place stating that null is not allowed except elsewhere mentioned...

Do you know anyone who could answer this question?

Thank you,
Michael Wirz

-- 
abs IT Service GmbH
abs gruppe
Michael Wirz
Entwicklung

Landsberger Stra├če 57
82266 Stegen am Ammersee
Telefon: +49 (0)8143 999 43
Telefax: +49 (0)8143 999 49

Michael.Wirz@abs.de
www.eFonds24.de


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message