cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: JingTransformer
Date Thu, 01 Sep 2005 15:59:07 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/684.html

Document ID: 684
Branch: main
Language: default
Name: JingTransformer (unchanged)
Document Type: Document (unchanged)
Updated on: 9/1/05 3:58:45 PM
Updated by: Pier Fumagalli

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 3275 bytes (previous version: 58 bytes)
Content diff:
    <html>
    <body>
    
--- <p>Put content here...</p>
+++ <p>The <tt>JingTransformer</tt> provides a very simple <tt>Transformer</tt>
+++ implementation validating documents in a pipeline using the
+++ <a href="http://relax-ng.org/">RELAX-NG</a> grammar through the
+++ <a href="http://www.thaiopensource.com/relaxng/jing.html">JING</a> validation
+++ engine.</p>
    
+++ <p>The configuration for this transformer is extremely easy: Like any other
+++ component, it needs to be declared in a sitemap's
+++ <tt>&lt;map:components/&gt;</tt> section:</p>
+++ 
+++ <pre>&lt;map:components&gt;
+++   ...
+++   &lt;map:transformers default="..."&gt;
+++     ...
+++ 
+++     <strong>&lt;map:transformer name="jing"
+++         logger="sitemap.transformer.jing"
+++         src="org.apache.cocoon.transformation.JingTransformer"&gt;
+++ 
+++       &lt;!--+ The enable-caching configuration element is optional
+++           | (defaults to true) and defines whether compiled RelaxNG
+++           | schemas should be stored in Cocoon's transient cache or not
+++           +--&gt;
+++       &lt;!-- &lt;enable-caching&gt;true&lt;/enable-caching&gt; --&gt;
+++     &lt;/map:transformer&gt;</strong>
+++ 
+++   ...
+++   &lt;/map:transformers&gt;
+++ &lt;/map:components&gt;
+++ </pre>
+++ 
+++ <p>The only defined (but <strong>not required</strong>) configuration
element
+++ for this component is
+++ <tt>&lt;enable-caching&gt;<em>true|false</em>&lt;/enable-caching&gt;</tt>
+++ indicating whether the schemas processed and compiled by
+++ <a href="http://www.thaiopensource.com/relaxng/jing.html">JING</a> should
be
+++ stored in Cocoon's transient store and reused.</p>
+++ 
+++ <p>Caching is a good idea if in your Cocoon application you are working with not
+++ many and usually not modified schemas, while if on the other hand your
+++ application generates RNG schemas dynamically, you might wish to disable
+++ caching.</p>
+++ 
+++ <p>Note that enabling or disabling caching of compiled schemas does
+++ <strong>not</strong> affect the pipeline's cacheability at all. In both cases
+++ (whether compiled schemas are cached or not) the <tt>JingTransformer</tt>
+++ always exposes a full <tt>SourceValidity</tt> instance to the calling pipeline,
+++ populated with the correct information to evaluate the validity of a possibly
+++ cached request.</p>
+++ 
+++ <p>The use of the <tt>JingTransformer</tt> is again extremely simple.
Simply
+++ declare it in the pipeline like any other transformer:</p>
+++ 
+++ <pre>&lt;map:pipeline type="..."&gt;
+++   ...
+++ 
+++   &lt;map:match src="..."&gt;
+++     &lt;map:generate src="..."/&gt;
+++     ...
+++     <strong>&lt;map:transform type="jing" src="myschema.rng"/&gt;</strong>
+++     ...
+++     &lt;map:serialize type="..."/&gt;
+++   &lt;/map:match&gt;
+++ 
+++   ...
+++ &lt;/map:pipeline&gt;
+++ </pre>
+++ 
+++ <p>Following the example above, the document being processed in the pipeline
+++ will be validated using the "<tt>myschema.rng</tt>"
+++ <a href="http://relax-ng.org/">RELAX-NG</a> schema, and the entire pipeline
will
+++ fail throwing a <tt>SAXException</tt> if an error was detected validating.</p>
+++ 
+++ <p>Note that if multiple errors occur in any document, only the first one will
+++ be reported: this transformer doesn't give you a report of all errors in the
+++ document, it simply fail on the first error detected.</p>
+++ 
+++ <p>Also note that the <tt>JingTransformer</tt> can read schemas (and
will
+++ include sub-schemas) from URIs such as "<tt>cocoon:...</tt>" or any other
URI
+++ supported by Cocoon's <tt>SourceResolver</tt>.</p>
+++ 
    </body>
    </html>


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
no changes

Mime
View raw message