【问题标题】:Why does DTD error "White spaces are required between publicId and systemI" occur with Spring XSD为什么Spring XSD会出现DTD错误“publicId和systemID之间需要空格”
【发布时间】:2014-03-13 17:39:55
【问题描述】:

在我的应用程序上下文文件中,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">

谢谢

【问题讨论】:

    标签: spring xsd dtd spring-integration


    【解决方案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">
    

    【讨论】:

    • 谢谢。关于为什么我们会在 XSD 中出现 DTD 错误的任何想法?
    • 因为任何 XSD(无论如何都是 XML)都依赖于 DTD,就像任何 XML 文档一样
    猜你喜欢
    • 2013-04-18
    • 2021-07-20
    • 2015-04-14
    • 1970-01-01
    • 2016-02-19
    • 1970-01-01
    • 2018-05-08
    • 1970-01-01
    相关资源
    最近更新 更多