Upayavira wrote:
Lars Huttar wrote:
Hi all,
I have the following problem.
We have a CASE-like Cocoon application that generates a bunch of code and writes it to a destination folder. It also copies some boilerplate files. It does the file copying by (1) generating a set of xincludes, which are run through the XInclude transformer, and (2) writing result to disk using SourceWritingTransformer. (This is done together with a set of cincludes, so that we can generate both static and dynamic code in one pipeline.)
However, this method seems inefficient as a way of copying large files that need no pipeline processing. Why parse them into SAX and then serialize them back out again? Yes, I'm using <source:write serializer="text">, but they still have to go through SAX.
Also, if I try to peek at the intermediate output, between the XInclude transformer that brings in a file and the SourceWritingTransformer that writes it, I get errors from binary files:
"XML Parsing Error: reference to invalid character number" or "An invalid character was found in text content." And no wonder. (In Firefox, this error prevents me from seeing much of the intermediate XML. In IE, I get an error popup, but I can still look over the XML. Sure I could use IE for this case, but the less I have to remember to switch browsers the better. And my boss would appreciate a cleaner solution than that.)
One alternative that has been suggested is to use Ant. However, Ant can be a configuration headache, especially since recent Cocoon has its own version of Ant and the library versions can conflict with any other version that may be on the system, if I recall right. Moreover, it just makes the deployment of our application messier if the user has to install Cocoon from source in order to include Ant so they can use our app. But this is a possibility nevertheless.
Looking for ways to write files on cocoon.apache.org and the wiki, I found that I could use the "/cocoon.processPipelineTo/ method from flowscript, to save the result of a pipeline to a file" (http://wiki.apache.org/cocoon/SavingFilesToFileSystem).
But the result is the same: static file contents have to get parsed into the XML pipeline unnecessarily; and if I tried to look at the intermediate XML before the writing occurs, I'd get browser errors.
I suppose another possibility would be to extend the SourceWritingTransformer to be able to copy files without having their contents in the pipeline. I've never extended a component before, but maybe this is the time to get my feet wet. Seems like this would be useful to other folks.
Thanks for any suggestions,
Is there a reason why you can't just do this from flowscript? Anything you can do in Java, you can do there.
Regards, Upayavira
Sounds like a possibility...
can you outline what this would look like? Sounds like you would use Javascript in your flow?
Would I still be able to do it from my pipeline that generates xincludes / cincludes and runs them through a SourceWritingTransformer?
Thanks, Lars
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
