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 9:36:34 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: 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><!--+ The shared Validator instance in Cocoon.
+++ |
+++ | This defaults to an instance of a "CachedValidator". To disable schema
+++ | caching add the following attribute to the <validator ... />
element:
+++ |
+++ |
class="org.apache.cocoon.components.validation.impl.DefaultValidator"
+++ +-->
+++
+++ <validator logger="core.validation">
+++ <schema-parser name="jing"
class="org.apache.cocoon.components.validation.jing.JingSchemaParser"/>
+++ <schema-parser name="jaxp"
class="org.apache.cocoon.components.validation.jaxp.JaxpSchemaParser">
+++
<factory-class>org.apache.xerces.jaxp.validation.XMLSchemaFactory</factory-class>
+++ </schema-parser>
+++ </validator>
+++ </pre>
+++
+++ <p>Simply the root tag <tt><validator/></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
with
+++ 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)
</tbody>
</table>
--- <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
for
+++ 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:http://relaxng.org/ns/structure/1.0</tt> for the JING
+++ <tt>SchemaParser</tt><tt><br/>
+++ </tt></li>
+++ <li><tt>jaxp:</tt><tt>http://relaxng.org/ns/structure/1.0</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>
+++
</body>
</html>
Fields
======
no changes
Links
=====
no changes
Custom Fields
=============
no changes
Collections
===========
no changes