cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Updated: Validation
Date Tue, 13 Sep 2005 21:36:41 GMT
A document has been updated:

Document ID: 683
Branch: main
Language: default
Name: Validation (unchanged)
Document Type: Document (unchanged)
Updated on: 9/13/05 9:36:34 PM
Updated by: Pier Fumagalli

A new version has been created, state: publish

This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 7367 bytes (previous version: 4610 bytes)
Content diff:
(61 equal lines skipped)
    inconsistancies in the notification and the ValidationHandler will throw
    <tt>SAXException</tt>s only when the error handler is configured to do so.</p>
+++ <h1>Configuring the validation framework in <tt>cocoon.xconf</tt> files</h1>
+++ <p>Configuration of the validation framework is extremely easy. If you built the
+++ "<tt>validation</tt>" block together with Cocoon, you should already have
+++ something like the following in your <tt>build/webapp/WEB-INF/cocoon.xconf</tt>
+++ file:</p>
+++ <pre>&lt;!--+ The shared Validator instance in Cocoon.
+++     |
+++     | This defaults to an instance of a "CachedValidator". To disable schema
+++     | caching add the following attribute to the &lt;validator ... /&gt; element:
+++     |
+++     |   class="org.apache.cocoon.components.validation.impl.DefaultValidator"
+++     +--&gt;
+++ &lt;validator logger="core.validation"&gt;
+++   &lt;schema-parser name="jing" class="org.apache.cocoon.components.validation.jing.JingSchemaParser"/&gt;
+++   &lt;schema-parser name="jaxp" class="org.apache.cocoon.components.validation.jaxp.JaxpSchemaParser"&gt;
+++     &lt;factory-class&gt;org.apache.xerces.jaxp.validation.XMLSchemaFactory&lt;/factory-class&gt;
+++   &lt;/schema-parser&gt;
+++ &lt;/validator&gt;
+++ </pre>
+++ <p>Simply the root tag <tt>&lt;validator/&gt;</tt> specifies
the Validator
+++ instance to use. Caching of schemas is the default behavior, you can see from
+++ the example above how this can be disabled.</p>
+++ <p>To support multiple grammars, the <tt>Validator</tt> can be configured
+++ more than one <tt>SchemaParser</tt>. Each <tt>SchemaParser</tt>
can support more
+++ than one grammar (for example, the <tt>jaxp</tt> parser declared above will
+++ support all the grammars supported by your Java Virtual Machine JAXP library).
+++ </p>
+++ <p>This means that in some case, multiple providers (or <tt>SchemaParser</tt>s)
+++ can support the same grammar. We'll see later how to make sure that a specific
+++ <tt>SchemaParser</tt> is used when needed.</p>
    <h1>A note on grammars</h1>
    <p>For grammars written in XML, wherever possible their name will be the
(58 equal lines skipped)
--- <p>xxx</p>
+++ <p>This implies that normally, automatic detection of grammars will work on
+++ analyzing the root element's namespace of the schema document. And of course (as
+++ stated above) this will not work on non-XML schema languages.</p>
+++ <p>In addition to the grammar name, one could prefix the grammar name with an
+++ extra identifier to select a specific provider or <tt>SchemaParser</tt>: if
+++ example both the JAXP and JING parsers declared in the <tt>cocoon.xconf</tt>
+++ snippet above can handle the RELAX NG grammar, one could use the following two
+++ identifiers to select specifically one implementation over another:</p>
+++ <ul>
+++ <li><tt>jing:</tt> for the JING
+++ <tt>SchemaParser</tt><tt><br/>
+++ </tt></li>
+++ <li><tt>jaxp:</tt><tt></tt>
for the JAXP
+++ <tt>SchemaParser</tt></li>
+++ </ul>
+++ <p>In other words, the grammar identifier can be prefixed by the schema parser
+++ name declared in <tt>cocoon.xconf</tt> separated by the colon character.</p>

no changes

no changes

Custom Fields
no changes

no changes

View raw message