Guido Casper wrote: > Did anyone else also feel the need to have something like > processPipelineTo but getting a DOM
Yes, I use that quite often, so it would be good if FOM could provide some easier to use functionality for this. We could have a processPipelineToDOM(uri, map) that returns a DOM. I would also like a processPipelineToSource(uri, map, modifiableSourceURI) which would simlify writing pipeline content to e.g. files and repositorys. It could also be used together with the xmodule source (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25210) to put DOM with the pipeline content in whatether object that can be accessable from an output module. Implementation details ---------------------- In the processPipelineToDOM we can the avoid the serialize to output stream reparse to SAX steps by using the same mechanism as in the o.a.c.components.source.impl.SitemapSource. I.e. instead of using the process(String uri, Object bizData, OutputStream out, Environment env) from o.a.c.components.flow.AbstractInterpreter, we could write a process(String uri, Object bizData, ContentHandler out, Environment env), that process the pipeline directly to a ContentHandler, that in turn could write the DOM, se the toSAX method in the SitemapSource for details. Something similar could be used for the processPipelineToSource, but here we would need some convention for knowing when a ModifiableSource can accept SAX input, before migrating to the Excalibur sources there was an interface o.a.c.environment.WritableSource that had a method that returned a ContentHandler for that purpose. One could of course let the ModifiableSource implement XMLConsumer, but that is a litle bit unconvinient as there are so many methods in that interface, I would prefer to ihave an interface that just returns a ContentHandler e.g. public interface SAXWritable { ContentHandler getContentHandler(); } WDYT? > or just an InputStream instead of > just streaming it directly to another OutputStream? Have not found any use of that yet. > > Guido > > > Geoff Howard wrote: > >>Upayavira wrote: >>>Maybe my last question was too specific. >>>I'm trying to parse the contents of a source into a DOM in >>>Flowscript, but am getting all sorts of errors. Can anyone provide a better way than this (which doesn't work)? I have not access to my code ATM but take a look at the loadDocument and saveDocument function in http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/samples/flow/binding_example.js That code can in turn be simplified to a few lines by using the toDOM and getSource methods is o.a.c.components.source.SourceUtil /Daniel
