新建文件 classroom.dtd文件,
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT classroom (classname,grade,students+) > 定义classroom包含三个对象
<!ATTLIST classroom id ID #REQUIRED> 定义classroom包含id属性 ID 标示为唯一码,#REQUIRED标记必有
<!ELEMENT classname (#PCDATA)>
<!ELEMENT grade (#PCDATA)>
<!ELEMENT students (student )>
<!ELEMENT student(id,name,age)>
<!ELEMENT id (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
新建classroom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE classroom SYSTEM "classroom.dtd"> 若引用内部文件用SYSTEM,若引用网络上的外部文件则用PUBLIC