You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by BURGHARD Éric <er...@systheo.com> on 2004/11/02 15:03:26 UTC

how to get the xml serializer

Hi !

I'm writing a new source module.

I set-up some new pipelines with this module in the generator and everything
is working correctly, ... well not exactly

When i try to cinclude the xml from these pipelines in another pipeline i
get an exception (unable to find the xml serializer component from the
serializer selector component).

The problem comes from the getInputStream() method. I took the one that came
with XMLDBSource.java so i guess that xmldb: module has the same problem. 

The serializer is to be selected by

manager = (ServiceManager)
this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
serializerSelector = (ServiceSelector) manager.lookup(Serializer.ROLE +
"Selector");
serializer = (Serializer)serializerSelector.select("xml");

which throw the exception

The only components (related to serialization) i could find in the manager
is the org.apache.cocoon.components.sax.XMLSerializer and the
org.apache.cocoon.components.sax.XMLDeSerializer, but it seems complicated
for my purposes.

Any idea ?

regards



Re: how to get the xml serializer

Posted by BURGHARD Éric <er...@systheo.com>.
Luigi Bai wrote:

> You need to make sure there is a serializer with the name "xml" declared
> in your sitemap.xmap file (or a parent sitemap) before you use your source
> module.
>

thanks for your answer,

the xml serializer is effectively declared in my main sitemap ;-(. It's not
the default one, but it is declared as xml.

i use the source module in a pipeline, say test
i can view the test url in a browser. When i debug, the xml serializer is
correctly selected, everything seems to be ok.
but when i <ci:include "cocoon:/test"/> into another document, the exception
is thrown ???.

I can instantiate directly an XMLSerializer, configure it, and recycle it at
the end and it work everytime (url and cinclude). But i think it's ugly.
isn't it ?

regards


Re: how to get the xml serializer

Posted by Luigi Bai <lp...@focalpoint.com>.
You might also consider making the name of the serializer a parameter, 
which defaults to the value "xml". Otherwise, it's this "magic" name that 
must be understood as a silent dependency.

Luigi

On Tue, 2 Nov 2004, Luigi Bai wrote:

> You need to make sure there is a serializer with the name "xml" declared in 
> your sitemap.xmap file (or a parent sitemap) before you use your source 
> module.
>
> Luigi
>
> On Tue, 2 Nov 2004, BURGHARD [ISO-8859-15] �ric wrote:
>
>> Hi !
>> 
>> I'm writing a new source module.
>> 
>> I set-up some new pipelines with this module in the generator and 
>> everything
>> is working correctly, ... well not exactly
>> 
>> When i try to cinclude the xml from these pipelines in another pipeline i
>> get an exception (unable to find the xml serializer component from the
>> serializer selector component).
>> 
>> The problem comes from the getInputStream() method. I took the one that 
>> came
>> with XMLDBSource.java so i guess that xmldb: module has the same problem.
>> 
>> The serializer is to be selected by
>> 
>> manager = (ServiceManager)
>> this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
>> serializerSelector = (ServiceSelector) manager.lookup(Serializer.ROLE +
>> "Selector");
>> serializer = (Serializer)serializerSelector.select("xml");
>> 
>> which throw the exception
>> 
>> The only components (related to serialization) i could find in the manager
>> is the org.apache.cocoon.components.sax.XMLSerializer and the
>> org.apache.cocoon.components.sax.XMLDeSerializer, but it seems complicated
>> for my purposes.
>> 
>> Any idea ?
>> 
>> regards
>> 
>> 
>

Re: how to get the xml serializer

Posted by Luigi Bai <lp...@focalpoint.com>.
You need to make sure there is a serializer with the name "xml" declared 
in your sitemap.xmap file (or a parent sitemap) before you use your source 
module.

Luigi

On Tue, 2 Nov 2004, BURGHARD [ISO-8859-15] �ric wrote:

> Hi !
>
> I'm writing a new source module.
>
> I set-up some new pipelines with this module in the generator and everything
> is working correctly, ... well not exactly
>
> When i try to cinclude the xml from these pipelines in another pipeline i
> get an exception (unable to find the xml serializer component from the
> serializer selector component).
>
> The problem comes from the getInputStream() method. I took the one that came
> with XMLDBSource.java so i guess that xmldb: module has the same problem.
>
> The serializer is to be selected by
>
> manager = (ServiceManager)
> this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
> serializerSelector = (ServiceSelector) manager.lookup(Serializer.ROLE +
> "Selector");
> serializer = (Serializer)serializerSelector.select("xml");
>
> which throw the exception
>
> The only components (related to serialization) i could find in the manager
> is the org.apache.cocoon.components.sax.XMLSerializer and the
> org.apache.cocoon.components.sax.XMLDeSerializer, but it seems complicated
> for my purposes.
>
> Any idea ?
>
> regards
>
>
>