cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Updated: ValidationReportTransformer
Date Sat, 18 Mar 2006 19:20:43 GMT
A document has been updated:

Document ID: 691
Branch: main
Language: default
Name: ValidationReportTransformer (unchanged)
Document Type: Sitemap Component (previously: Cocoon Document)
Updated on: 3/18/06 7:15:18 PM
Updated by: Bruno Dumon

A new version has been created, state: publish

This part has been removed.

Long description
This part has been added.
Mime type: text/xml
File name: null
Size: 3924 bytes

<p>The <tt>ValidationReportTransformer</tt> is a <tt>Transformer</tt>
reports about the validation of a document in Cocoon pipeline using the
validation framework provided by the <a href="daisy:683">validation block</a>.

<p>To configure this transformer do as with any other component: it needs to be
declared in a sitemap's <tt>&lt;map:components/&gt;</tt> section:</p>

  &lt;map:transformers default="..."&gt;
<strong>    &lt;map:transformer name="validation-report"

      &lt;!--+ The "grammar" an optional configuration element specifying the default
            | grammar used by the validator. When the "grammar" element is specified,
            | the automatic detection of schema types will be disabled.
            | This can also be specifed in pipelines as a parameter:
            |   &lt;map:parameter name="grammar" value="... grammar identifier ..."/&gt;
            | For a list of well known grammars, see the JavaDoc documentation for the
            | org.apache.cocoon.components.validation.Validator interface.
      &lt;!-- &lt;grammar&gt;... grammar identifier ...&lt;/grammar&gt;
</strong>    ...

<p>The only defined (but <strong>not required</strong>) configuration element
for this component is <tt>&lt;grammar&gt;<em>... grammar identifier
...</em>&lt;/grammar&gt;</tt> indicating the grammar to pass to the Validator
component. See the documentation of the <a href="daisy:683">validation block</a>
for more information on what this means.</p>

<p>The use of the <tt>ValidatingTransformer</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="validation-report" src="myschema.rng"&gt;
      &lt;!-- &lt;map:parameter name="grammar" value="... identifier ..."/&gt;
   </strong> ...
    &lt;map:serialize type="..."/&gt;


<p>Following the example above, the document being processed in the pipeline
will be validated using the "<tt>myschema.rng</tt>" schema (the
<tt>Validator</tt> will autodetect this to be a
<a href="">RELAX-NG</a> schema), and the entire pipeline
will fail throwing a <tt>SAXException</tt> if an error was detected validating.

<p>The optional "<tt>grammar</tt>" parameter will override at run time whatever
configuration parameter was specified in the <tt>&lt;map:components/&gt;</tt>
section of the pipeline. For example one might not declare a grammar in the
configuration (letting the normal grammar auto-detection to work) and override
it for a specific pipeline with the XML DTD grammar identifier (which can't be
detected, as it's not an XML document).</p>

<p>After the validation is completed, the <tt>ValidationReportTransformer</tt>
will emit a report somehow similar to this one:</p>

<pre>&lt;report xmlns=""&gt;
  &lt;warning system="..." public="..." line="..." column="..."&gt;
    ... detailed message ...
  &lt;error system="..." public="..." line="..." column="..."&gt;
    ... detailed message ...
  &lt;fatal system="..." public="..." line="..." column="..."&gt;
    ... message ...

<p>The location attributes specified in the <tt>&lt;warning/&gt;</tt>,
<tt>&lt;error/&gt;</tt> and <tt>&lt;fatal/&gt;</tt>
tags are all optional and
will be generated only if known.</p>


no changes

no changes

Custom Fields
no changes

no changes

View raw message