SaveFilesTransformer

A simplified SourceWritingTransformer.

Description

This transformer can be used to save portions of XML to a file or capture the stream output of a url and write that to a file.

Particularly useful to easily store generated content _and_ copy (un)related files along with the output files in a single transform. For instance when processing all files in an input directory.

This transformer listens to the http://daidalos.nl/cocoon/save/1.0 namespace.

Original author GeertJosten.

Declaration

In order to use it you have to declare the Transformer as a sitemap component:

Invocation

You can call it as any other Transformer:

Usage

Insert instructions in the content stream in one of the following formats:

To write an XML fragment to a file..

To write the complete result of a Cocoon or external call (XML or binary)..

Note: src and serializer attributes are mutually exclusive. Specifying both attributes will cause an Exception!

Configuration

No configuration currenly.

Bugs

None known. This Cocoon component has been used in a few production level and several experimental projects.

Source code

See attached file. The source is provided as-is, no guaranties, no support.

Note: it was originally developed for Cocoon 2.1.4, but it compiled straight-away with Cocoon 2.1.6. I reccon compiling it for even newer versions should not be a problem.


SaveFilesTransformer.java

SaveFilesTransformer (last edited 2009-09-20 23:41:41 by localhost)