Reputation: 10662
For example, I want instead of referring to an online XSD like this:
<persistence xmlns="…" xmlns:xsi="…"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://www.oracle.com/…/persistence_2_1.xsd"> <!-- online -->
To refer to a classpath XSD like this:
<persistence xmlns="…" xmlns:xsi="…"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
org/hibernate/jpa/persistence_2_1.xsd"> <!-- classpath -->
Upvotes: 4
Views: 8124
Reputation: 415
My team had problem that Spring Boot couldn't find schema for Spring profiled unit tests when xsi:schemaLocation
was provided as
classpath:xmlschemas/requiredSchema.xsd
After hours of debugging the solution was to use relative path:
/xmlschemas/requiredSchema.xsd
(xmlschemas directory was in resources root)
Upvotes: 4
Reputation: 163262
There's no standardized way of doing this. Some products may support classpath URIs: classpath:org/hibernate/jpa/persistence_2_1.xsd
. If your product doesn't, you can probably write a plugin (LSResourceResolver) that enables the capability.
Upvotes: 4