Xml DTD格式不正确

Xml DTD格式不正确,xml,dtd,Xml,Dtd,有人能指出我错在哪里吗。。。这真是让我大吃一惊 正在为某些XML编码编写DTD。。。我在解析XML时不断遇到错误 ret.dtd:2:文档类型声明包含或指向的标记声明必须格式良好 我会发布一些代码,希望有人能提供帮助 <!DOCTYPE ret [ <!-- 1. The element ret 1.1. The element ret has an attribute version that must have the value 1.0 1.2. The

有人能指出我错在哪里吗。。。这真是让我大吃一惊

正在为某些XML编码编写DTD。。。我在解析XML时不断遇到错误

ret.dtd:2:文档类型声明包含或指向的标记声明必须格式良好

我会发布一些代码,希望有人能提供帮助

<!DOCTYPE ret [
<!-- 
1.      The element ret
1.1.    The element ret has an attribute version that must have the value 1.0
1.2.    The element ret has a required attribute date that has a text representing the date of feed.
1.3.    The element ret can have 0 or more feed elements 
1.4.    The element ret's last element is a required doc-copyright element.  The copyright statement for your company. -->

<!ELEMENT ret (feed)*>
<!ATTLIST ret version CDATA #FIXED "1.0">
<!ATTLIST ret date CDATA #REQUIRED >

<!--
2.  The element feed
2.1.    The element feed starts with a required source element.  Must appear exactly once. The source of the feed
2.2.    The element feed's second element feed-desc is optional, but if present, appears no more than once.  This is a description of the feed and its source.
2.3.    The element feed's third element info is optional, but if present, appears no more than once.  This is additional information about the feed.
2.4.    The element feed's last element is a required stories element. Must appear exactly once. A list of feed stories. -->


这是我的DTD的开始…我遗漏了什么吗?

在内容模型之外使用星号应该不会有问题。模型
(提要)*
应该可以。(可以使用Xerces或验证。)

根据错误中的文件名“ret.dtd”,看起来您正在使用外部dtd。外部DTD中不应包含DOCTYPE声明。DOCTYPE声明应该在XML实例中。尝试从DTD中删除


还有一个问题与此错误相同,并通过删除重复的DOCTYPE声明得到解决:

欢迎使用堆栈溢出。埃里克·雷蒙德(Eric Raymond)和里克·莫恩(Rick Moen)的文章中有关于提出有效问题的好建议。您提供的DTD部分并非格式错误。我建议尝试制作一个最小的完整的工作示例:一个说明您的问题并引出错误消息的最小可能的示例。