You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Peter Meggitt <pm...@eviasoft.com> on 2004/02/10 01:00:22 UTC

How to perform RelaxNG validation in forrest

I am using relaxng schemas and wish to perform xml validation. I read
somewhere that James Clark was recommending using a processing instruction
to associate an xml file with a relaxng schema:

<?xml version="1.0" encoding="UTF-8"?>
<?relaxng-compact external "doc-v10.rnc"?>
<doc>
</doc>

I assume the <xmlvalidate> ant task will ignore this. I know it is easy to
validate against a particular relaxng schema in forrest.build.xml:

  <target name="validate-skinconf" depends="validation-props"
    if="validate.skinconf">
    <jing compactSyntax="true"

rngfile="${forrest.home}/context/resources/schema/relaxng/skinconf.rnc">
      <fileset dir="${content-dir}"
        includes="${forrest.validate.skinconf.includes}"
        excludes="${forrest.validate.skinconf.excludes}"/>
    </jing>
    <echo message="...validated skinconf"/>
  </target>

However this gets tedious when a large number of relaxng schemas are used,
as forrest.build.xml constantly needs to be updated.

Does anyone know of an ant task or other mechanism that can be used to
validate xml files against relaxng schemas, where the schema used is either
determined from a processing instruction or somehow looked up?

Regards
Peter Meggitt



Re: How to perform RelaxNG validation in forrest

Posted by Johan Kok <jk...@messianic.dyndns.org>.

David Crossley wrote:

>.......
>I just goolged for an answer and found this:
>http://www.dpawson.co.uk/relaxng/nxml/schemaloc.html
>Would those interested please investigate that and report back.
>I will try too but i don't promise anything.
> 
>Determining which relaxng grammar to apply is something that
>Forrest should be able to help with. At the moment we are only
>doing validation at Ant build time, so "forrest" is not used.
>
>It would be great if Cocoon/Forrest would optionally do
>validation at run-time. That way, when we are doing the local
>webapp with 'forrest run' and editing and then immediately
>viewing results, we could be doing various relaxng validations
>and content verifications. Similarly when using 'forrest'.
>
>More importantly, we would be using the "sitemap" to associate
>the grammars, rather than the hack of specifying that inside
>each xml instance document.
>
>People more knowledgeable with Cocoon might help. Does it
>mean that we need a special type of Cocoon Transformer?
>  
>
Love you ideas, be cause once working it would be very easy to do a 
WYSIWYG editor within forrest, which is determined by the XLS used, 
typically DOC vXX. or any of the special types like FAQ etc. This will 
buy a load of 'brownie' points with users.

>--David
>
>
>
>
>
>
>  
>


Re: How to perform RelaxNG validation in forrest

Posted by David Crossley <cr...@apache.org>.
Peter Meggitt wrote:
> I am using relaxng schemas and wish to perform xml validation.
<snip for bevity/>
>
> However this gets tedious when a large number of relaxng schemas are used,
> as forrest.build.xml constantly needs to be updated.
> 
> Does anyone know of an ant task or other mechanism that can be used to
> validate xml files against relaxng schemas, where the schema used is either
> determined from a processing instruction or somehow looked up?

Yes there is an ant task for Jing - that is what we are using
in the forrest main build file and in the project build.

There are many aspects to the issues that you raise.
I just goolged for an answer and found this:
http://www.dpawson.co.uk/relaxng/nxml/schemaloc.html
Would those interested please investigate that and report back.
I will try too but i don't promise anything.
 
Determining which relaxng grammar to apply is something that
Forrest should be able to help with. At the moment we are only
doing validation at Ant build time, so "forrest" is not used.

It would be great if Cocoon/Forrest would optionally do
validation at run-time. That way, when we are doing the local
webapp with 'forrest run' and editing and then immediately
viewing results, we could be doing various relaxng validations
and content verifications. Similarly when using 'forrest'.

More importantly, we would be using the "sitemap" to associate
the grammars, rather than the hack of specifying that inside
each xml instance document.

People more knowledgeable with Cocoon might help. Does it
mean that we need a special type of Cocoon Transformer?

--David