The starting point for a Pipeline. It generates the input to the pipeline as a series of SAX events.

Therefore the contract between a Generator and the downstream elements in the pipeline are SAX events: if it can generate SAX events (or can be made to do so), then it can be a generator.

The simplest generator is one that reads an XML document from the file system. i.e. an SAX Parser.


Generators are declared in the Sitemap:

<map:generators default="file">
<map:generator name="file"

The default attribute on the generators element indicates that if a pipeline does not declare a generator, then this default will be automatically used.


Example generator entry:

<map:match pattern="hello.html">
<map:generate src="docs/samples/hello-page.xml"/>
<map:transform src="stylesheets/page/simple-page2html.xsl"/>
<map:serialize type="html"/>

Provided Implementations

There are several generators provided with Cocoon:

Some generators require additional libraries (PHP servlet, Velocity engine, JSP engine, HTMLTidy, etc).

Generator (last edited 2009-09-20 23:40:40 by localhost)