cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <>
Subject Re: Writing XML to disc
Date Mon, 19 May 2003 12:32:52 GMT
Upayavira wrote:

>Within the CLI, I want to write some config XML to disc from a DOM object.

See XConfToolTask - it does that.

>The code I'm using is as follows:
>            selector = (ComponentSelector)manager.lookup(Serializer.ROLE + 
>            serializer = (Serializer)"xml");
>            stream = new FileOutputStream(new File(context, cacheFile));
>            serializer.setOutputStream(stream);
>            DOMStreamer streamer = new DOMStreamer(serializer);
>  ;
>But I get "Unnamed Selector: Component Selector could not find the component 
>for hint [xml]".
>I suspect the problem might be with my ComponentManager. I added the following 
>to the end of so that the CLI can get hold of a ComponentManager.
>    public ExcaliburComponentManager getComponentManager() {
>        return this.componentManager;
>    }
>Now, in the CLI, this component manager can happily find XML Parsers, and 
>seems able to find a SourceResolver too. It can also find a ComponentSelector for 
>Serializers. However, when I use the selector to get an XML Serializer, it can't find

>it. Following the code through, this ComponentManager doesn't have a Parent. Is 
>this component manager configured with all of the components in the 


> or should I get my manager from somewhere else?

All the serializers are declared in the sitemap(s) -- thus, they are 
present in the sitemap's component manager. And when sitemap1 defines 
serializer 'xxx' as com.mycompany.MySerializer1, some other sitemap2 may 
define same serializer 'xxx' as com.mycompany.MySerializer2. Now, which 
component manager do you want - from what sitemap?

>I also need the manager to get a SourceResolver for resolving ModifiableSources.

You should be able to get it from the Cocoon's component manager.


View raw message