XML validation against XSD 1.1 with Xerces in Java

一个人想着一个人 提交于 2019-12-01 03:47:18

It looks that you need Xerces2 Java 2.11.0 (XML Schema 1.1) (Beta) version, which isn't in maven repository. You can download it from Xerces website, and install it to your local maven repository: mvn install:install-file -Dfile=xercesImpl.jar -DgroupId=xerces -DartifactId=xercesImpl -Dversion=2.11.0.beta -Dpackaging=jar Then you will be able to include it in your Maven project dependencies:

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.11.0.beta</version>
</dependency>   

I will add another answer, because for me this dependency did not work (same error as described by OP):

<dependency>
  <groupId>xerces</groupId>
  <artifactId>xercesImpl</artifactId>
  <version>2.11.0</version>
</dependency>

I quess 2.11.0 should be newer than 2.11.0.beta, but it seems like xsd1.1 is not supported in that version !

Instead only the following dependency lead to a working XSD1.1 validation for me:

<dependency>
    <groupId>org.opengis.cite.xerces</groupId>
    <artifactId>xercesImpl-xsd11</artifactId>
    <version>2.12-beta-r1667115</version>
</dependency>

( Found in this SO thread: How to validate XML against XSD 1.1 in Java? )

I think they have added version 2.11 to maven now. The following dependency in Maven works out-of-the-box:

<dependency>
  <groupId>xerces</groupId>
  <artifactId>xercesImpl</artifactId>
  <version>2.11.0</version>
</dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!