Dear Wiki user, You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change notification.
The following page has been changed by GeertJosten: http://wiki.apache.org/cocoon/SaveFilesTransformer The comment on the change is: Initial version on wiki New page: === SaveFilesTransformer === A simplified [http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/transformation/SourceWritingTransformer.html 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 [http://www.linkedin.com/pub/1/754/433 GeertJosten]. ==== Declaration ==== In order to use it you have to declare the [:Transformer] as a sitemap component: {{{ <map:transformers> .... <map:transformer logger='transformer.savefiles' name='savefiles' src='org.apache.cocoon.transformation.SaveFilesTransformer'/> .... </map:transformers> }}} ==== Invocation ==== You can call it as any other [:Transformer]: {{{ <map:match> .... <map:transform name='savefiles' /> .... </map:match> }}} ==== Usage ==== Insert instructions in the content stream in one of the following formats: To write an XML fragment to a file.. {{{ <save:file target="myTargetFileName" serializer="xml" xmlns:save="http://daidalos.nl/cocoon/save/1.0"> ... some xml fragment ... </save:file> }}} To write the complete result of a Cocoon or external call (XML or binary).. {{{ <save:file src="mySourceUrl" target="myTargetFileName" xmlns:save="http://daidalos.nl/cocoon/save/1.0" /> }}} 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. [[BR]] attachment:SaveFilesTransformer.java
