XML Schema Location Optimization

After looking at an even more cryptic error message, I understand that they can be caused by the dummy URIs present here:

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd "> 

Is online schema good?

From the foregoing, for example:

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

works fine, it's all nice and nice when you have no problems with the Internet, and when Springframework.org gets up, etc., but then, from the above, also:

 http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd 

which gives:

 "Oops! This link appears to be broken" 

Actually.

What is the best practice regarding URIs related to a scheme in a project?

Bonus question: how does Eclipse not complain in real time about broken links? (IntelliJ IDEA does it right !?)

+4
source share
2 answers

Spring does not load the schemas over the network when the container starts - there is a mechanism for embedding schemas in the jar files of the Spring file, and Spring uses these built-in schemas to validate xml. This also applies to all custom namespaces.

Eclipse may complain, because Eclipse downloads schemes based on the URI of the scheme, which may not be located on the network, for example, in your case there is a way to cache your own schemes in the Eclipse settings.

+3
source

Source: https://habr.com/ru/post/1337031/


All Articles