commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Herscu <>
Subject Re: [jelly] Schema validation problems
Date Thu, 07 Jul 2005 09:08:24 GMT

First, thanks for your reply.
Now, I will introduce myself -- well, I am a retard!
Really, I am playing with this Jelly stuff for about ten-twenty hours.
Anyway, your clues are great!

Have a nice day,

Dion Gillard wrote:
> On 7/7/05, Adrian Herscu <> wrote:
>>Hi all,
>>I am trying to build a Maven plugin for validating XML. Currently I have
>>this code:
>><!-- assume ${schema.type.uri} is -->
>>   var="verifierFactory"
>>   value=
>>"${org.iso_relax.verifier.VerifierFactory.newInstance(schema.type.uri)}" />
> I'm reasonably sure the above variable will be null.
>><!-- assume everything in ${file.set} is an XML file -->
>><ant:fileScanner var="fileSet">
>>   <ant:fileset dir="${file.set}" />
>>   var="verifier"
>>   factory="${verifierFactory}"
>>   uri="schema.uri" />
>><echo>Validating using ${verifierFactory.getClass().toString()}</echo>
>><core:forEach items="${fileSet.iterator()}" var="file">
>>   <echo>Validating ${file}</echo>
>>   <validate:validate var="validationResult" verifier="${verifier}">
>>     <core:include uri="file:///${file}" />
>>   </validate:validate>
>>   <echo>Validation result: ${validationResult}</echo>
>>There are several problems with this code:
>>1. If the schema file pointed by ${schema.uri} references other schema
>>file by using a relative URL, then that URL is resolved relatively to
>>the location from where the validation process was started (the path
>>from where Maven was launched), instead of being resolved relatively to
>>the first schema file location (this is what XML schema validators do --
>>checked with MSXML3.0 and with Xerces).
> Is that because you are validating the body of the validate tag?
>>2. If the schema instance (i.e. the validated file) contains an
>>"xsi:schemaLocation" attribute in its root element then this error is
>><error column="-1" line="-1">unexpected attribute
>>and the ${validationResult} is set to 'false'.
> Is this an issue with the validator or the validate tag?
>>3. If the validation failed once (like in #3), then errors are not
>>thrown anymore, only the ${validationResult} is set to 'false'.
> I'm not too familiar with the validate tag lib, but maybe you need a
> new error handler??
>>4. If <core:include uri="..." /> references a local file path then that
>>file path must be prepended with "file:///", otherwise it is prepended
>>at run-time with the process launch path. For example:
>>- local file path: E:\myxmldir\foo.xml
>>- process launch path: E:\myworkdir
>>then Jelly will seek for something impossible:
>>Thanks a lot for your time,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message