Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change 
notification.

The following page has been changed by DavidPérez:
http://wiki.apache.org/cocoon/ValidationTransformer

------------------------------------------------------------------------------
  </map:resource>
  }}}
  
- As you can see in the {{{src}}} attribute we pass a URL that points to a DTD, 
Relax NG Schema or XML Schema.  Any valid protocol is valid, even the 
{{{cocoon:}}} one.
+ As you can see in the {{{src}}} attribute we pass a URL that points to a DTD, 
Relax NG Schema or XML Schema.  Any valid protocol is valid, even the 
{{{cocoon:}}} one.  Relax NG Schemas are much more powerful and easy to 
generate.
  
  ==== Configuration ====
  
@@ -55, +55 @@

        ....
        <map:transformer logger='transf.validate' name='validate' 
src='fcc.ima.cocoon.ValidatorTransformer'>
                <active>false</active>
+                 
<defaultFactory>com.thaiopensource.relaxng.jarv.VerifierFactoryImpl</defaultFactory>
        </map:transformer> 
        ....
  </map:transformers>
  }}}
+ 
+ The {{{<factory>}}} element specifies the default validator factory.  It can 
be overriden with the parameter of the same name.  Its default value is 
{{{com.sun.msv.verifier.jarv.TheFactoryImpl}}}.  This means to use the {{{Sun 
Multi-Schema XML Validator}}}.  See later under the pre-requisites section.
  
  The following boolean parameters control if processing must be aborted in 
case of a warning, an error or a fatal error:
   *  stop-for-errors, default value {{{false}}}.
@@ -114, +117 @@

  </report>
  }}}
  
+ ==== Locating errors ====
+ 
+ If the generator provides a 
[http://www.docjar.com/docs/api/org/xml/sax/Locator.html document locator], the 
line and column number are provided.
+ This allows to easily locate the error.
+ In any other case a pseudo-XPath syntax is used like this 
{{{rootElement/subElement[number]/subElement[number]/....}}}.
+ 
+ Example:
+ 
+ If an error is reported in {{{html/body[2]/div[5]}}} it means that the error 
appears in a div element, that is the fifth child element (not the fifth 
{{{<div>}}} element!) of a {{{<body>}}} element.  This {{{<body>}}} element is 
the second child of the {{{<html>}}} root tag.
+ 
  ==== Declaration ====
  
  In order to use it first you have to declare the transformer as a sitemap 
component:
@@ -152, +165 @@

  
  Both transformers use a product called 
[http://wwws.sun.com/software/xml/developers/multischema/ Sun Multi-Schema XML 
Validator].  It has been tested with version {{{20030225}}}.  You need to place 
the file {{{msv.jar}}} and other ones this product needs like {{{xsdlib.jar}}}, 
{{{relaxngDatatype.jar}}} and {{{isorelax.jar}}} in {{{WEB-INF/lib}}} of your 
{{{Cocoon}}} installation.  All these JARs are included in {{{msv.zip}}}.
  
- An alternative to MSV is Jing http://www.thaiopensource.com/relaxng/jing.html 
and isorelax http://iso-relax.sourceforge.net/.
+ An alternative to {{{MSV}}} is 
[http://www.thaiopensource.com/relaxng/jing.html Jing] and 
[http://iso-relax.sourceforge.net/ isorelax].
- I have tested both and prefer MSV because it gives clearer validation 
messages.
+ I have tested both and personally prefer {{{MSV}}} because it gives clearer 
validation messages.
  
  In order to use Jing, you have to specify this verification factory: {{{}}}