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.

Declaration

Generators are declared in the Sitemap:

<map:generators default="file">
<map:generator name="file"
                src="org.apache.cocoon.generation.FileGenerator"
                label="content"/>
...
</map:generators>

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

Usage

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"/>
</map:match>

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)