forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: schema formats
Date Wed, 23 Nov 2005 03:54:07 GMT
Diwaker Gupta wrote:
> I know David made some commits using RNG schemas earlier, but I'm not quite 
> confident with them yet. Do we need to do anything special to use RNG 
> schemas? How about XSD schemas?

The transformers can be inserted into any pipeline, even at
multiple "map:transform" steps.

I don't have time to make a proper example, but here is the general idea.
Add this to your project sitemap.xmap file.

-----------
<map:match pattern="validation/xhtml2.xml">
  <map:generate src="{project:content.xdocs}/xhtml2.xml"/>
  <map:transform type="validate"
      src="{forrest:context}/resources/schema/relaxng/WD-xhtml2-20050527/xhtml2-forrest.rng"/>
  <map:serialize type="xml"/>
</map:match>
<map:match pattern="validation-report/xhtml2.xml">
  <map:generate src="{project:content.xdocs}/xhtml2.xml"/>
  <map:transform type="validation-report"
      src="{forrest:context}/resources/schema/relaxng/WD-xhtml2-20050527/xhtml2-forrest.rng"/>
  <map:serialize type="xml"/>
</map:match>
-----------

Then request either:
 localhost:8888/validation/xhtml2.xml
or
 localhost:8888/validation-report/xhtml2.xml

(However, note that something is now not correct with this
xhtml2 example. This did used to work with the earlier cocoon-2.2
which used Jing directly.)

If you want to do some other validation, then of course you
will substitute your own schema.

According to Pier's documentation, various schema languages
can be used:
http://cocoon.zones.apache.org/daisy/documentation/blocks/validation.html
http://cocoon.zones.apache.org/daisy/documentation/components/transformers/validatingtransformer.html

See the Cocoon samples at
http://cocoon.zones.apache.org/demos/release/samples/blocks/validation/welcome

-David

Mime
View raw message