写xml时候的一个坑
<DOCTYPE scores[]>这一行总是显示错误,折腾了一晚上,后来无意错误在于:<!ELEMENT scores(student+)>应该写成:<!ELEMENT scores (student+)>,即scores和(student+)之间应该有一个空格,scores是根目录,student是根目录的一个元素。
<?xml version="1.0" encoding="UTF-8"?> <!-- 声明内部DTD --> <!DOCTYPE scores [ <!ELEMENT scores (student+)> <!ELEMENT student (name,course,score)> <!ATTLIST student id CDATA #REQUIRED> <!ELEMENT name (#PCDATA)> <!ELEMENT course (#PCDATA)> <!ELEMENT score (#PCDATA)> ]> <scores> <student id="1"> <name>王同</name> <course>java</course> <score>89</score> </student> <student id="2"> <name>李佳</name> <course>sql</course> <score>58</score> </student> </scores>