XML Schema Reference

I have two XML schemas. First ( A.xsd) is in the jar file of the library ( mylib.jar), and the second ( B.xsd) is in my project.

I want to import A.xsdinto B.xsdand validate incoming XML through the built-in validator Jaxb2Marshaller.

However, I cannot get it to work correctly: it seems that the internal XML validator Jaxb2Marshallerdoes not understand file references in jar files (I just want to write something like that <xs:import namespace="http://my/schema.xsd" schemaLocation="classpath:schema.xsd">).

How can this be fixed? How can I attach a library schema to a project schema?

+3
source share
3 answers

Check out my answer to the previous question on how ResourceResolver can be used to solve this problem:

LSResourceResolver .

+4

. jaxb classpath:.

JAXB, .

+1

classpath: is not a valid URL for the location of the schema. You will need to use XML directories to load schemas from jars.

0
source

All Articles