cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Updated: Your first XML pipeline
Date Fri, 04 May 2007 10:30:41 GMT
A document has been updated:

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


This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 2854 bytes (previous version: 860 bytes)
Content diff:
    <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>
    <p>Cocoon is based around the concept of pipelines:</p>
(13 equal lines skipped)
    <li>HTML serializer</li>
+++ <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
+++ 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>&lt;map:sitemap xmlns:xsi=""
+++  xsi:schemaLocation=""
+++  xmlns:map=""&gt;
+++   &lt;map:pipelines&gt;
+++ <strong>    &lt;map:pipeline&gt;
+++       &lt;map:match pattern="myFirstPipeline"&gt;
+++         &lt;map:generate src="myXmlFile.xml"/&gt;
+++         &lt;map:serialize type="xml"/&gt;
+++       &lt;/map:match&gt;
+++     &lt;/map:pipeline&gt;</strong>
+++     [...]
+++   &lt;/map:pipelines&gt;
+++ &lt;/map:sitemap&gt;
+++ </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>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;myFirstPipeline&gt;test&lt;/myFirstPipeline&gt;
+++ </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
+++ 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>
+++ you will see the output of your first own pipeline serialized as XML.</p>
    <h1>Adding an XSLT transformation step</h1>
(7 equal lines skipped)

View raw message