放在同个目录下就可以了。
DTD:
<?xml version="1.0" encoding="UTF-8"?> <!--本地dtd文件:<!DOCTYPE students SYSTEM "student.dtd">--> <!--网络dtd文件:<!DOCTYPE students PUBLIC "名称空间" "student.dtd">--> <!--“#PCDATA”表示元素中嵌套的是普通的文本字符串--> <!-- ATTLIST 表示属性--> <!ELEMENT students (student*) > <!ELEMENT student (name,age,sex)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT sex (#PCDATA)> <!ATTLIST student number ID #REQUIRED>
xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE students SYSTEM "DTD.dtd"> <students> <student number="a00" > <name>tom</name> <age>12</age> <sex>女</sex> </student> </students>