简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM