A document has been updated: http://cocoon.zones.apache.org/daisy/documentation/1290.html
Document ID: 1290 Branch: main Language: default Name: Your first XML pipeline (unchanged) Document Type: Cocoon Document (unchanged) Updated on: 5/4/07 10:30:38 AM Updated by: Reinhard Pötz A new version has been created, state: publish Parts ===== Content ------- This part has been updated. Mime type: text/xml (unchanged) File name: (unchanged) Size: 2854 bytes (previous version: 860 bytes) Content diff: <html> <body> <p>This tutorial is based on the <a href="daisy:1159">"Your first Cocoon --- application using Maven 2" guide</a></p> +++ application using Maven 2" guide</a> which shows how to bootstrap a Cocoon +++ project.</p> --- <h1>which shows how to bootstrap a Cocoon project.</h1> --- <h1>Overview</h1> <p>Cocoon is based around the concept of pipelines:</p> (13 equal lines skipped) <li>HTML serializer</li> </ul> +++ <p>Sitemaps connect requests with those sitemaps by definining rules. When a +++ rule matches, the pipeline is executed.</p> +++ <h1>Create a pipeline in the sitemap</h1> --- <p>TBD</p> +++ <p>First, open <tt>src\main\resources\COB-INF\sitemap.xmap</tt> in your favorite +++ XML editor. That's your block's base sitemap. There are already some pipelines +++ there (/sitemap/pipelines) but for this purpose of this tutorial, let's create +++ your own pipeline.</p> +++ <pre><map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +++ xsi:schemaLocation="http://apache.org/cocoon/sitemap/1.0 http://cocoon.apache.org/schema/sitemap/cocoon-sitemap-1.0.xsd" +++ xmlns:map="http://apache.org/cocoon/sitemap/1.0"> +++ +++ <map:pipelines> +++ <strong> <map:pipeline> +++ <map:match pattern="myFirstPipeline"> +++ <map:generate src="myXmlFile.xml"/> +++ <map:serialize type="xml"/> +++ </map:match> +++ </map:pipeline></strong> +++ [...] +++ </map:pipelines> +++ +++ </map:sitemap> +++ </pre> +++ +++ <p>The <tt>map:match </tt>element has an attribute <tt>@pattern</tt>. If the +++ request <tt>http://localhost:8888/myBlock1/<strong>myFirstPipeline</strong></tt> +++ comes in, this matcher "matches" and the request processing continues with the +++ generation of myXmlFile.xml. This file has to be in the same directory as the +++ sitemap:</p> +++ +++ <pre><?xml version="1.0" encoding="UTF-8"?> +++ <myFirstPipeline>test</myFirstPipeline> +++ </pre> +++ +++ <p class="note">You might wonder why the matcher only has to look for the +++ pattern myFirstPipeline. The reason is that <tt>myBlock1</tt> is handled by the +++ block dispatching mechanism. In particular for your block, this path is set in +++ <tt>src/main/resources/META-INF/cocoon/spring/servlet-service.xml</tt> in +++ <tt>/beans/bean[id='com.mycompany.myBlock4.block']/context/@mount-path</tt></p> +++ +++ <p>After saving the sitemap and the XML file, you can point you browser to +++ <tt>http://localhost:8888/myBlock</tt><tt><tt>1</tt>/myFirstPipeline</tt> and +++ you will see the output of your first own pipeline serialized as XML.</p> +++ <h1>Adding an XSLT transformation step</h1> <p>TBD</p> (7 equal lines skipped)