cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <Giacomo.P...@pwr.ch>
Subject Re: Namespace problem in C2 Transformer
Date Mon, 04 Sep 2000 19:10:24 GMT
The problem I remember has to do with Xerces. I've read that there is a new version out there
which has this bug fixed. I'll commit a new xerces as soon as I can be shure it works with
current xalan.

Giacomo

On Mon, Sep 04, 2000 at 06:26:51PM +0200, Nicola Ken Barozzi wrote:
> I'm making a C2 Transformer and I have problems with namespaces.
> This is my xml:
> 
> <?xml version="1.0"?>
> <contain>
> <chartdef xmlns="http://apache.org/cocoon/Chart2Svg">
> <appearance>
>       <title>IT WORKS!!! :)</title>
>       <LF3d/>
>       <colors>
>          <color>#ffffff</color>
>          <color>#666666</color>
>       </colors>
>    </appearance>
>   <properties>
>       <min>0</min>
>       <max>10</max>
>    </properties>
>    <data>
>       <result xmlns="http://apache.org/cocoon/data">
>          <row>
>             <name>1</name>
>             <surname>4</surname>
>          </row>
>          <row>
>             <name>5</name>
>             <surname>4</surname>
>          </row>
>          <row>
>             <name>3</name>
>             <surname>7</surname>
>         </row>
>      </result>
>    </data>
>  </chartdef>
> </contain>
> 
> 
> Basically I want to read the <result xmlns="http://apache.org/cocoon/data"> 
> elements (I just say the transformer to ignore elements out of my <data> element)
> in my transformer.
> The two tags with the namespace declarations:
> 
> <chartdef xmlns="http://apache.org/cocoon/Chart2Svg">
> <result xmlns="http://apache.org/cocoon/data"> 
> 
> are giving me a headache.
> If I capture their startElement and endElement events and don't call anything in
> them, they disappear in the output but at the and of the _correct_ output I
> get the following exception:
> 
> **********************************************************
> 
>  ?????? ?????? ?????? ?????? ?????? ??????
>  ?      ?   .? ?      ?   .? ?.   ? ?    ?
>  ?????? ?????? ?????? ?????? ?????? ?    ? @version@
> 
> --- Error in the Cocoon 2 pipeline >X==< ---
> 
>  error - Exception in transformer chart2svg with uri http://apache.org/cocoon/Chart2Svg
while ending element.
> 
>  description - java.lang.NullPointerException
> 
>  from - org.apache.cocoon.generation.ErrorGenerator
> 
>  source - org.xml.sax.SAXException
> 
>  stacktrace - java.lang.NullPointerException
>         at org.apache.cocoon.transformation.EventBasedAbstractTransformer.endElement(EventBasedAbstractTransformer.java
> , Compiled Code)
>         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java, Compiled Code)
>         at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java,
Compiled Code)
>         at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java,
Compiled
> Code)
>         at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java,
Compiled Code)
>         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)
>         at org.apache.cocoon.components.parser.XercesParser.parse(XercesParser.java:40)
>         at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:31)
>         at org.apache.cocoon.sitemap.ResourcePipeline.process(ResourcePipeline.java,
Compiled Code)
>         at _C_._jakarta_tomcat._webapps._cocoon._sitemap_xmap.process(_sitemap_xmap.java:1415)
>         at org.apache.cocoon.sitemap.SitemapHandler.process(SitemapHandler.java:127)
>         at org.apache.cocoon.sitemap.SitemapManager.invoke(SitemapManager.java:83)
>         at org.apache.cocoon.Cocoon.process(Cocoon.java:206)
>         at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:191)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled
Code)
>         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
>         at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
>         at java.lang.Thread.run(Thread.java:479)
> 
> 
> **************** printStream notifications: 1 ***************
> 
> The exception disappears only if I call super on both events (two start, two end).
> It also disappears if I only take away xmlns="http://apache.org/cocoon/data" .
> 
> I get the same error with:
> 
> <contain>
> <chart:chartdef xmlns:chart="http://apache.org/cocoon/Chart2Svg">
> <chart:appearance>
>       <chart:title>IT WORKS!!! :)</chart:title>
>       <chart:LF3d/>
>       <chart:colors>
>          <chart:color>#ffffff</chart:color>
>          <chart:color>#666666</chart:color>
>       </chart:colors>
>    </chart:appearance>
>   <chart:properties>
>       <chart:min>0</chart:min>
>       <chart:max>10</chart:max>
>    </chart:properties>
>    <chart:data>
>       <result>
>          <row>
>             <name>1</name>
>             <surname>4</surname>
>          </row>
>          <row>
>             <name>5</name>
>             <surname>4</surname>
>          </row>
>          <row>
>             <name>3</name>
>             <surname>7</surname>
>         </row>
>       </result>
>    </chart:data>
>   </chart:chartdef>
> </contain>
> 
> but it stops calling after </chart:chartdef>.
> The strange thing is that in the output I _have_ </contain> !!! :-O
> 
> So I looked in th AbstractTransformer I extend.
> 
> Why is it
> 
>    /**
>      * End the scope of a prefix-URI mapping.
>      */
>     public void endPrefixMapping(String prefix)
>     throws SAXException {
>     }
> 
> and not
> 
>    /**
>      * End the scope of a prefix-URI mapping.
>      */
>     public void endPrefixMapping(String prefix)
>     throws SAXException {
>         if (super.contentHandler!=null)
>         System.out.println("PM!"+prefix);
>             super.contentHandler.endPrefixMapping(prefix);
>     }
> 
>  ?
> 
> Thanks guys :-)
> 
> nicola_ken
> 
> 
> 
>          
> 
> 

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1  856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1  856 2201
Hintereichenstrasse 7                     Mobil: +41 (0)78 759 7703 
CH-8166 Niederweningen                    Mailto:Giacomo.Pati@pwr.ch 
                                          Web:   http://www.pwr.ch 


Mime
View raw message