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: Validation
Date Tue, 13 Sep 2005 19:18:37 GMT
A document has been updated:

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

Document ID: 683
Branch: main
Language: default
Name: Validation (unchanged)
Document Type: Document (unchanged)
Updated on: 9/13/05 7:18:33 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: 2507 bytes (previous version: 338 bytes)
Content diff:
    <html>
    <body>
    
    <p>The "<tt>validation</tt>" block provides a number of components to
allow
--- validation of documents within <a href="http://cocoon.apache.org/">Cocoon</a>.
--- </p>
+++ validation of documents according to schemas expressed in different grammars
+++ from within <a href="http://cocoon.apache.org/">Cocoon</a>.</p>
    
--- <p>So far, the first (and only) component provided by the "<tt>validation</tt>"
--- block is the <tt><a href="daisy:684">JingTransformer</a></tt></p>
+++ <p>The "<tt>validation</tt>" block, on top of providing a
+++ <tt>ValidatingTransformer</tt> to validate documents in a pipeline, and a
+++ <tt>ValidationReportTransformer</tt> to produce validity reports, provides
also
+++ a simple framework to access validation capabilities from within other
+++ components.</p>
    
+++ <h1>Validation Framework: the <tt>Validator</tt> interface</h1>
+++ 
+++ <p>The main entry point for the validation framework is the
+++ <tt>org.apache.cocoon.components.validation.Validator</tt> interface, which
+++ specify an extremely simple way to produce handlers able to validate XML
+++ documents.</p>
+++ 
+++ <p>One can get a hold on a <tt>Validator</tt> instance using Avalon's
normal
+++ lookup mechanism:</p>
+++ 
+++ <pre>import org.apache.cocoon.components.validation.Validator;
+++ 
+++ public class MyClass {
+++   ...
+++   public void myMethod() {
+++     Validator validator = (Validator) this.serviceManager.lookup(Validator.ROLE);
+++     ...
+++   }
+++ }
+++ </pre>
+++ 
+++ <p>A <tt>Validator</tt>, basically, abstracts the idea of accessing
a schema. It
+++ is designed to be grammar language independent, and in most cases (when
+++ necessary, and unknown by the caller) it <em>should</em> be able to
+++ automatically determine the type of the grammar of the supplied schema.</p>
+++ 
+++ <p class="warn">Well known exceptions to the automatic schema detection are
+++ grammars not written in parseable XML (such as the RELAX NG Compact grammar, or
+++ XML DTDs). Unfortunately the complexity of writing detection algorithms for
+++ those languages would be so complicated to probably outweight the benefits of
+++ having them.</p>
+++ 
+++ <p>Once obtained an instance of a <tt>Validator</tt>, normally one would
invoke
+++ one of the <tt>getValidationHandler(...)</tt> methods (depending on the
+++ available parameters) to obtain handlers that will actually perform the
+++ validation of a series of SAX events.</p>
+++ 
+++ <p>One parameter always required by the <tt>getValidationHandler(...)</tt>
is
+++ the source of the schema to use for validation (either as a <tt>String</tt>
or
+++ an Excalibur <tt>Source</tt> instance).</p>
+++ 
+++ <p>Optionally, one could also specify the <em>grammar </em>of the schema
to use.
+++ This will force the Validator to try and parse the schema using a specified
+++ language (for example Relax NG, or the XML Schema Language) and should be used
+++ whenever</p>
+++ 
    </body>
    </html>


Fields
======
no changes

Links
=====
no changes

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

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

Mime
View raw message