cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: Namespace problem in C2 Transformer
Date Wed, 06 Sep 2000 09:26:24 GMT
Nicola Ken Barozzi wrote:
> 
> ----- Original Message -----
> From: "Stefano Mazzocchi" <stefano@apache.org>
> To: <cocoon-dev@xml.apache.org>
> Sent: Monday, September 04, 2000 7:30 PM
> Subject: Re: Namespace problem in C2 Transformer
> 
> > 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 :-)
> >
> > Because you found a bug :)
> >
> > Fixing it right away...
> 
> If it can help, the problem hase gone away with Xerces 1.2 (the latest).

Is it out? didn't know.

Anyway, I also applied your patch which is very reasonable and doesn't
hurt.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message