我正在尝试为 XML 文件编写 DTD。这里是:https ://prod-c2g.s3.amazonaws.com/db/Winter2013/files/courses-noID.xml
这是我的 DTD
<!ELEMENT Course_Catalog (Department*) >
<!ELEMENT Department (Title*, Chair*, Course*) >
<!ATTLIST Department Code CDATA #REQUIRED >
<!ELEMENT Title ANY >
<!ELEMENT Chair (Professor) >
<!ELEMENT Professor (First_Name, Middle_Initial?, Last_Name) >
<!ELEMENT First_Name ANY >
<!ELEMENT Last_Name ANY >
<!ELEMENT Course (Title, Description?, Instructors, Prerequisites?) >
<!ATTLIST Course Number CDATA #REQUIRED Enrollment CDATA #IMPLIED >
<!ELEMENT Description ANY >
<!ELEMENT Instructors (Professor*, Lecturer?) >
<!ELEMENT Lecturer (First_Name, Middle_Initial?, Last_Name) >
<!ELEMENT Middle_Initial ANY >
<!ELEMENT Prerequisites (Prereq*)>
<!ELEMENT Prereq ANY >
好吧,它看起来几乎没问题,但有一个小错误。它说“有效性错误:元素讲师内容不遵循 DTD,期待(教授*,讲师?),得到(讲师教授教授)”。不是 * 表示任何元素个数?为什么会报错?