在xml内部定义DTD
建立index.xml文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book SYSTEM "outer.dtd">
<book>
<bookname>java</bookname>
<author>小米</author>
<publishing>手机出版社</publishing>
</book>
建立dtd约束outer.dtd:
<?xml version="1.0" encoding="UTF-8" ?>
<!ELEMENT book(bookname,author,publishing)>
<!ELEMENT bookname (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publishing (#PCDATA)>