为什么Eclipse无法解析spring-dwr架构?

Rob*_*ell 12 xml eclipse schema spring dwr

Eclipse在我的Spring的applicationContext.xml中显示以下错误:

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dwr:configuration'.   myappservlet-servlet.xml    MyApp/src/main/webapp/WEB-INF   line 23 XML Problem
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dwr:controller'.  myappservlet-servlet.xml    MyApp/src/main/webapp/WEB-INF   line 21 XML Problem
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'dwr:remote'.  myappservlet-servlet.xml    MyApp/src/main/webapp/WEB-INF   line 41 XML Problem
Run Code Online (Sandbox Code Playgroud)

当我将鼠标悬停在订单项错误上时,它还会说:

    - schema_reference.4: Failed to read schema document 'http://www.directwebremoting.org/
 schema/spring-dwr-3.0.xsd', because 1) could not find the document; 2) the document could not be 
 read; 3) the root element of the document is not <xsd:schema>.
Run Code Online (Sandbox Code Playgroud)

我确认根元素实际上是<xsd:schema>.当我通过键入<dwr使用自动完成时: Eclipse正确地向我显示了各种选项,如<dwr:configuration>,<dwr:controller>等.如果Eclipse不知道读取模式就知道这一点?

我毫无问题地使用了许多不同的命名空间; DWR模式是唯一未解析的模式.这是宣言:

<?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:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
              http://www.springframework.org/schema/aop 
              http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-2.5.xsd
              http://www.directwebremoting.org/schema/spring-dwr
              http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd"
    default-autowire="byName">
Run Code Online (Sandbox Code Playgroud)

我的classpath中有最新的DWR 3.0.0.116.rc1.如果我打开DWR jar,我会发现META-INF/spring.handlers包含:

http\://www.directwebremoting.org/schema/spring-dwr=org.directwebremoting.spring.DwrAnnotationNamespaceHandler
Run Code Online (Sandbox Code Playgroud)

META-INF/spring.schemas包含:

http\://www.directwebremoting.org/schema/spring-dwr-2.0.xsd=org/directwebremoting/spring/spring-dwr-2.0.xsd
http\://www.directwebremoting.org/schema/spring-dwr-3.0.xsd=org/directwebremoting/spring/spring-dwr-3.0.xsd
Run Code Online (Sandbox Code Playgroud)

冒号逃离了我,但我认为这一切都是正确的,否则每个人的DWR都会被打破.

在我从DWR网站实时抓取这个特定模式之前,当我的生产系统崩溃因为DWR网站崩溃时我得到了一点点.

Ric*_*ler 11

您可以尝试向Eclipse添加用户指定的目录贡献.在Window-> Preferences-> XML-> XML Catalog下,选择User Specified Entries,然后选择Add按钮.

然后,您可以添加架构的详细信息(如果连接断开,您可以在本地复制文件).然后,Eclipse将在验证期间访问模式.