You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/08 03:01:30 UTC
[Cocoon Wiki] Updated: ValidationTransformer
Date: 2004-07-07T18:01:30
Editor: DavidCrossley <cr...@apache.org>
Wiki: Cocoon Wiki
Page: ValidationTransformer
URL: http://wiki.apache.org/cocoon/ValidationTransformer
fix broken link to Transformer
Change Log:
------------------------------------------------------------------------------
@@ -1,32 +1,32 @@
=== Description ===
-In this page I present a [:transformer] that can be inserted in any stage of an XML pipeline, in order to validate its contents. This can be a powerful tool for debugging and conformance testing. All detected errors and warnings are dumped to the logs. The transformer uses directly SAX events in order to validate.
+In this page I present a [:Transformer] that can be inserted in any stage of an XML pipeline, in order to validate its contents. This can be a powerful tool for debugging and conformance testing. All detected errors and warnings are dumped to the logs. The transformer uses directly SAX events in order to validate.
=== Declaration ===
In order to use it first you have to declare the transformer as a sitemap component:
-{{{
-<map:transformers>
- ....
- <map:transformer logger='transf.validate' name='validate' src='fcc.ima.cocoon.ValidatorTransformer'/>
- ....
-</map:transformers>
+{{{
+<map:transformers>
+ ....
+ <map:transformer logger='transf.validate' name='validate' src='fcc.ima.cocoon.ValidatorTransformer'/>
+ ....
+</map:transformers>
}}}
=== Use ===
Here is an excerpt of a pipeline that uses this transformer, to check that we are generating valid HTML.
-{{{
-<map:resource name='html'>
- <map:generate src='my-file.xml'/>
- <map:transform type='my-transform'/>
- <map:transform type='validate' src='validation/xhtml1-transitional.dtd'>
- <map:parameter name='active' value='true'/>
- </map:transform>
- <map:serialize type='html'/>
-</map:resource>
+{{{
+<map:resource name='html'>
+ <map:generate src='my-file.xml'/>
+ <map:transform type='my-transform'/>
+ <map:transform type='validate' src='validation/xhtml1-transitional.dtd'>
+ <map:parameter name='active' value='true'/>
+ </map:transform>
+ <map:serialize type='html'/>
+</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.
@@ -37,14 +37,14 @@
You can achieve this also globally:
-{{{
-<map:transformers>
- ....
- <map:transformer logger='transf.validate' name='validate' src='fcc.ima.cocoon.ValidatorTransformer'>
- <active>false</active>
- </map:transformer>
- ....
-</map:transformers>
+{{{
+<map:transformers>
+ ....
+ <map:transformer logger='transf.validate' name='validate' src='fcc.ima.cocoon.ValidatorTransformer'>
+ <active>false</active>
+ </map:transformer>
+ ....
+</map:transformers>
}}}
The following boolean parameters control if processing must be aborted in case of a warning, an error or a fatal error: