笔记 ------XML DTD验证

books.dtd:
<?xml version="1.0" encoding="GBK"?>
  <!ELEMENT  book-list (book*) >
	  <!ELEMENT  book (name?,author?, price?) >
	  <!ELEMENT name (#PCDATA) >
	  <!ELEMENT author (#PCDATA) >
	  <!ELEMENT price (#PCDATA) >
	  
	  <!--  ID 唯一表示记录信息 -->
	  <!ATTLIST  book   id  ID  #REQUIRED >





<?xml version="1.0" encoding="GBK"?>
<!-- 
	 SYSTEM  表示从本机查找dtd验证文件
	 PUBLIC  表示从网络中查找dtd规范的验证文件
-->
<!DOCTYPE book-list SYSTEM "books.dtd">
<book-list>
	<book id="a">
		<name>JAVA葵花宝典</name>
		<author>SUN</author>
		<price>unkown</price>
	</book>
</book-list>

 

你可能感兴趣的:(xml,sun)