关闭标记上的XML DTD错误-验证错误

关闭标记上的XML DTD错误-验证错误,xml,dtd,Xml,Dtd,我正在使用http://www.xmlvalidation.com/index.php验证我的DTD,但它在XML结束标记上产生错误 XML: 如何处理DTD中的结束标记?这与结束标记无关。您需要声明book的属性,并且需要修复book和description元素的模型 新DTD <!ELEMENT books (book+)> <!ELEMENT book (description)> <!ATTLIST book title CDATA #R

我正在使用
http://www.xmlvalidation.com/index.php
验证我的DTD,但它在XML结束标记上产生错误

XML:


如何处理DTD中的结束标记?

这与结束标记无关。您需要声明
book
的属性,并且需要修复
book
description
元素的模型

新DTD

<!ELEMENT books (book+)>
<!ELEMENT book (description)>
<!ATTLIST book
          title CDATA #REQUIRED
          imageurl CDATA #REQUIRED>
<!ELEMENT description (author, publisher, publishDate, ISBN10, ISBN13, blurb)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT publishDate (#PCDATA)>
<!ELEMENT ISBN10 (#PCDATA)>
<!ELEMENT ISBN13 (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>

注意:我需要
标题
图像URL
属性。根据您的数据,您可能希望暗示它们

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT books (book+)>
<!ELEMENT book (title, imageurl, description, author, publisher, publishDate, ISBN10, ISBN13, blurb)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT publishDate (#PCDATA)>
<!ELEMENT ISBN10 (#PCDATA)>
<!ELEMENT ISBN13 (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>
    4:  129 Attribute "imageurl" must be declared for element type "book".
    4:  129 Attribute "title" must be declared for element type "book".
    12: 19  The content of element type "description" must match "null".
    13: 10  The content of element type "book" must match "(title,imageurl,description,author,publisher,publishDate,ISBN10,ISBN13,blurb)".
    14: 129 Attribute "imageurl" must be declared for element type "book".
    14: 129 Attribute "title" must be declared for element type "book".
    22: 19  The content of element type "description" must match "null".
    23: 10  The content of element type "book" must match "(title,imageurl,description,author,publisher,publishDate,ISBN10,ISBN13,blurb)".
<!ELEMENT books (book+)>
<!ELEMENT book (description)>
<!ATTLIST book
          title CDATA #REQUIRED
          imageurl CDATA #REQUIRED>
<!ELEMENT description (author, publisher, publishDate, ISBN10, ISBN13, blurb)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT publishDate (#PCDATA)>
<!ELEMENT ISBN10 (#PCDATA)>
<!ELEMENT ISBN13 (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>