如何使用在线资源验证 xml 和 dtd
how to validate xml and dtd with online resource
我想使用 http://www.xmlvalidation.com/ 来验证 xml 和 dtd,但在处理 dtd 时出错。我添加了 dtd,但它不起作用。我想知道缺少什么。我将这两个文件复制并粘贴到一页上(没有使用外部文件)。
谢谢!
<Bookstore>
<Book ISBN = "ISBN-101" Price = "100" Authors = "JU JW">
<Title>
Introduction to Python
</Title>
</Book>
<Book ISBN = "ISBN-202" Price = "120" Authors = "HG JU JW">
<Title>
Digital Circuit Design
</Title>
<Remark>
Amazon.com says: Buy this book bundled with
<BookRef book = "ISBN-303" /> - a great deal!
</Remark>
</Book>
<Author Ident = "HG">
<Firstname>Hector</Firstname>
<Lastname>Garcia</Lastname>
</Author>
<Author Ident = "JU">
<Firstname>Jeffrey</Firstname>
<Lastname>Ullman</Lastname>
</Author>
<Author Ident = "JW">
<Firstname>Jennifer</Firstname>
<Lastname>Widom</Lastname>
</Author>
<!ELEMENT Bookstore(Book*, Author*)>
<!ELEMENT Book (Title, Remark?)>
<!ATTLIST Book ISBN ID #REQUIRED
Price CDATA #REQUIRED
Authors IDREFS #REQUIRED>
<!ELEMENT Title(#PCDATA)>
<!ELEMENT Remark(#PCDATA | BookRef)*>
<!ELEMENT BookRef EMPTY>
<!ATTLIST BokkRef book IDREF #REQUIRED>
<!ELEMENT Author(Firstname,Lastname)>
<!ATTLIST Author Ident ID #REQUIRED>
<!ELEMENT Firstname(#PCDATA)>
<!ELEMENT Lastname(#PCDATA)>
如果要合并 DTD 和 XML 实例,请添加 DOCTYPE 声明并将 DTD 声明放在内部子集中(添加 prolog)...
<!DOCTYPE Bookstore [
<!ELEMENT Bookstore (Book*, Author*)>
<!ELEMENT Book (Title, Remark?)>
<!ATTLIST Book ISBN ID #REQUIRED
Price CDATA #REQUIRED
Authors IDREFS #REQUIRED>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Remark (#PCDATA | BookRef)*>
<!ELEMENT BookRef EMPTY>
<!ATTLIST BookRef book IDREF #REQUIRED>
<!ELEMENT Author (Firstname,Lastname)>
<!ATTLIST Author Ident ID #REQUIRED>
<!ELEMENT Firstname (#PCDATA)>
<!ELEMENT Lastname (#PCDATA)>
]>
<Bookstore>
<Book ISBN="ISBN-101" Price="100" Authors="JU JW">
<Title>
Introduction to Python
</Title>
</Book>
<Book ISBN="ISBN-202" Price="120" Authors="HG JU JW">
<Title>
Digital Circuit Design
</Title>
<Remark>
Amazon.com says: Buy this book bundled with
<BookRef book="ISBN-303"/> - a great deal!
</Remark>
</Book>
<Author Ident="HG">
<Firstname>Hector</Firstname>
<Lastname>Garcia</Lastname>
</Author>
<Author Ident="JU">
<Firstname>Jeffrey</Firstname>
<Lastname>Ullman</Lastname>
</Author>
<Author Ident="JW">
<Firstname>Jennifer</Firstname>
<Lastname>Widom</Lastname>
</Author>
</Bookstore>
我修正了 DTD 声明中的一些拼写错误,但您的文件仍然存在 IDREF 无效(缺少相应 ID)的问题。
我想使用 http://www.xmlvalidation.com/ 来验证 xml 和 dtd,但在处理 dtd 时出错。我添加了 dtd,但它不起作用。我想知道缺少什么。我将这两个文件复制并粘贴到一页上(没有使用外部文件)。 谢谢!
<Bookstore>
<Book ISBN = "ISBN-101" Price = "100" Authors = "JU JW">
<Title>
Introduction to Python
</Title>
</Book>
<Book ISBN = "ISBN-202" Price = "120" Authors = "HG JU JW">
<Title>
Digital Circuit Design
</Title>
<Remark>
Amazon.com says: Buy this book bundled with
<BookRef book = "ISBN-303" /> - a great deal!
</Remark>
</Book>
<Author Ident = "HG">
<Firstname>Hector</Firstname>
<Lastname>Garcia</Lastname>
</Author>
<Author Ident = "JU">
<Firstname>Jeffrey</Firstname>
<Lastname>Ullman</Lastname>
</Author>
<Author Ident = "JW">
<Firstname>Jennifer</Firstname>
<Lastname>Widom</Lastname>
</Author>
<!ELEMENT Bookstore(Book*, Author*)>
<!ELEMENT Book (Title, Remark?)>
<!ATTLIST Book ISBN ID #REQUIRED
Price CDATA #REQUIRED
Authors IDREFS #REQUIRED>
<!ELEMENT Title(#PCDATA)>
<!ELEMENT Remark(#PCDATA | BookRef)*>
<!ELEMENT BookRef EMPTY>
<!ATTLIST BokkRef book IDREF #REQUIRED>
<!ELEMENT Author(Firstname,Lastname)>
<!ATTLIST Author Ident ID #REQUIRED>
<!ELEMENT Firstname(#PCDATA)>
<!ELEMENT Lastname(#PCDATA)>
如果要合并 DTD 和 XML 实例,请添加 DOCTYPE 声明并将 DTD 声明放在内部子集中(添加 prolog)...
<!DOCTYPE Bookstore [
<!ELEMENT Bookstore (Book*, Author*)>
<!ELEMENT Book (Title, Remark?)>
<!ATTLIST Book ISBN ID #REQUIRED
Price CDATA #REQUIRED
Authors IDREFS #REQUIRED>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Remark (#PCDATA | BookRef)*>
<!ELEMENT BookRef EMPTY>
<!ATTLIST BookRef book IDREF #REQUIRED>
<!ELEMENT Author (Firstname,Lastname)>
<!ATTLIST Author Ident ID #REQUIRED>
<!ELEMENT Firstname (#PCDATA)>
<!ELEMENT Lastname (#PCDATA)>
]>
<Bookstore>
<Book ISBN="ISBN-101" Price="100" Authors="JU JW">
<Title>
Introduction to Python
</Title>
</Book>
<Book ISBN="ISBN-202" Price="120" Authors="HG JU JW">
<Title>
Digital Circuit Design
</Title>
<Remark>
Amazon.com says: Buy this book bundled with
<BookRef book="ISBN-303"/> - a great deal!
</Remark>
</Book>
<Author Ident="HG">
<Firstname>Hector</Firstname>
<Lastname>Garcia</Lastname>
</Author>
<Author Ident="JU">
<Firstname>Jeffrey</Firstname>
<Lastname>Ullman</Lastname>
</Author>
<Author Ident="JW">
<Firstname>Jennifer</Firstname>
<Lastname>Widom</Lastname>
</Author>
</Bookstore>
我修正了 DTD 声明中的一些拼写错误,但您的文件仍然存在 IDREF 无效(缺少相应 ID)的问题。