Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I validate an XML file against a Schema using ant?

As part of my build process I want to validate XML files against a Schema (XSD). I'm trying to use the schemavalidate task like this:

<schemavalidate noNamespaceFile="schemas/Model.xsd" file="Model.xml"/>

This yields the following error:

[...]
BUILD FAILED
build.xml:65: The following error occurred while executing this line:
build.xml:59: Parser does not support Xerces or JAXP schema features

I'm using the latest ant distribution (1.7.1). Are any additional libraries needed to get validation to work?

like image 593
Christian Berg Avatar asked Dec 12 '25 04:12

Christian Berg


1 Answers

The schemavalidate task is actually working as shown in the question.

The problem was that the xsd file was not present. Unfortunately, the error message is rather confusing. Ant only complains about the missing file when it is started in verbose mode.

I'm closing this question.

like image 137
Christian Berg Avatar answered Dec 15 '25 15:12

Christian Berg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!