为什么在Spring XSD中出现DTD错误“publicId和systemI之间需要空格”

时间:2014-03-13 17:39:56

标签: spring xsd dtd spring-integration

在我的应用程序上下文文件中,Eclipse显示错误:

引用文件包含错误(http://www.springframework.org/schema/integration)。 applicationContext.xml第1行XML问题

查看Eclipse中的错误详细信息,我看到了:

            White spaces are required between publicId and systemId

根据有这个问题的其他人,它与DOCTYPE有关,显然必须有一个SYSTEM标识符。

为什么在2014年DOCTYPE几乎已经过时,因为我们都使用XSD而不是DTD而且http://www.springframework.org/schema/integration中没有DOCTYPE(或者应该有)这个错误会发生吗?

          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:mvc="http://www.springframework.org/schema/mvc"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:p="http://www.springframework.org/schema/p"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jee="http://www.springframework.org/schema/jee"
          xmlns:int="http://www.springframework.org/schema/integration" 
          xmlns:mail="http://www.springframework.org/schema/integration/mail"
          xsi:schemaLocation="http://www.springframework.org/schema/beans 
                       http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                       http://www.springframework.org/schema/mvc
                       http://www.springframework.org/schema/mvc/spring-mvc.xsd
                       http://www.springframework.org/schema/integration/mail 
                          http://www.springframework.org/schema/integration/mail/spring-integration-mail-3.0.xsd
                       http://www.springframework.org/schema/jee 
                       http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
                       http://www.springframework.org/schema/context
                       http://www.springframework.org/schema/integration
                       http://www.springframework.org/schema/integration/spring-integration-3.0.xsd
                       http://www.springframework.org/schema/context/spring-context.xsd">

由于

1 个答案:

答案 0 :(得分:1)

您必须将spring-context.xsd移至id

<beans 
http://www.springframework.org/schema/jee 
http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-3.0.xsd">