cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Upayavira" ...@upaya.co.uk>
Subject Writing XML to disc
Date Mon, 19 May 2003 10:08:14 GMT
Within the CLI, I want to write some config XML to disc from a DOM object. The 
code I'm using is as follows:

            selector = (ComponentSelector)manager.lookup(Serializer.ROLE + 
"Selector");
            serializer = (Serializer)selector.select("xml");
            stream = new FileOutputStream(new File(context, cacheFile));
            serializer.setOutputStream(stream);
            DOMStreamer streamer = new DOMStreamer(serializer);
            streamer.stream(cache);

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 Cocoon.java 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 
Cocoon.xconf, or should I get my manager from somewhere else?

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

I'm not that clued up on Avalon and its component stuff - I'd appreciate any help 
that's going.

Thanks in advance,

Upayavira


Mime
View raw message