2014-10-02 88 views
0

有人可以指出我錯在哪裏......這是嚴重地把我扔了一圈嗎?!?!?!DTD格式不正確

書面方式DTD的一些XML編碼...我不斷收到一個錯誤,當我分析

ret.dtd XML: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最開始的......我失去了什麼?

+0

歡迎堆棧溢出。在[SO幫助文件](http://stackoverflow.com/help/how-to-ask)以及Eric Raymond和Rick Moen的文章[如何以智能的方式提問]中提供有效問題的建議很好( http://catb.org/~esr/faqs/smart-questions.html)。你提供的DTD部分不是不合格的。我建議嘗試做一個最小的完整工作示例:儘可能最小的示例來說明您的問題並引發錯誤消息。 – 2014-10-07 15:37:02

回答

1

在內容模型外部使用星號時應該沒有問題。型號(feed)*應該沒問題。 (用Xerces或W3C Markup Validation Service很好驗證。)

根據錯誤中的文件名「ret.dtd」,它看起來像您正在使用外部DTD。外部DTD不應該在其中包含DOCTYPE聲明。 DOCTYPE聲明應該在XML實例中。嘗試從DTD中刪除<!DOCTYPE ret [(和]>)。

這裏的另一個問題是有同樣的錯誤,並通過刪除重複的DOCTYPE聲明解析:External referenced DTD in XML