ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heath, Graham" <>
Subject using <xmlvalidate> task with XML Schema 1.1 and Saxon
Date Mon, 10 May 2010 09:18:42 GMT
Greetings readers,

just to add my take on this..

I use ant extensively and with saxon too. My first attempts used the ant <xlst> task,
but that fell over when my stylesheets needed to use xslt2.0.
So I switched to <saxon-xslt>, except that then I could not switch on line-numbers and
tracing. After a discussion on the Saxon list Mike Kay updated Saxon so that  the remaining
gotchas from the <xslt> task were covered. This rendered the <saxon-xslt> task
as deprecated. So I have now switched back to the <xslt> task. Whereupon I also found
validation did not work. My validation task calls java direct.. Just at the moment it is not
a satisfactory solution as the java task does not fail even though the validation failed.
I think I remember reading something about that ages ago... Note that my task is actually
a macro which does other validation too..
      <java fork="true" classname="com.saxonica.Validate" failonerror="true"
          <pathelement location="${SaxonJar}"/>
        <arg value="-s:@{in}"/>
        <arg value="-xsd:@{xsd}"/>
        <arg value="-val:@{validationlevel}"/>

I include here Mike Kay's offline assessment of using saxon validate inside ant.

>It looks as if this task relies on the validation engine implementing XMLReader - that
is, it's assuming validation is something that parsers do.
>I would have expected something that expects to work with any validation engine to use
javax.xml.vaidation.Validator, or ValidationHandler, both of 
>which Saxon does implement.  I guess it's easy enough to provide a wrapper that implements
XMLReader if people need it.
>It's just a shame that ValidatorHandler is a concrete class rather than an interface.
Otherwise I could have made ValidatorHandlerImpl extend XMLFilter, >and you would get an
XMLReader for free.

>>Hi Mike, this looks like a similar problem that I have faced  (and run 
>>away from).
>> I reverted in the end to calling saxon directly from the command 
>>line for validation..

Hope this helps


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

View raw message