I'm supposed to be writing a DTD for an xml document but there is one particular section that is throwing me for a loop. In the EnrolledIn element there is character data and then course elements. I've tried to validate with the DTD below but I keep getting the error
"ERROR: Element EnrolledIn content does not follow the DTD, expecting (CDATA , Course+), got (CDATA Course Course Course Course )
ERROR: Element EnrolledIn content does not follow the DTD, expecting (CDATA , Course+), got (CDATA Course )".
I've tried using * and + after course but with no success. I'm using Notepad++ xml tools to validate.
<!DOCTYPE Students [
<!ELEMENT Students (Student*)>
<!ELEMENT Student (LastName, MiddleInitial?, FirstName, EnrolledIn?)>
<!ELEMENT LastName (#PCDATA)>
<!ELEMENT FirstName (#PCDATA)>
<!ELEMENT MiddleInitial (#PCDATA)>
<!ELEMENT EnrolledIn (CDATA, Course+)>
<!ELEMENT Course (#PCDATA)>
]>
<Students>
<Student>
<LastName> Doe </LastName>
<MiddleInitial>K.</MiddleInitial>
<FirstName>John</FirstName>
<EnrolledIn>
Courses enrolled in:
<Course>
TCSS 445 – Database Systems Design
</Course>
<Course>
TCSS 422 – Operating Systems
</Course>
<Course>
TCSS 422 – Operating Systems
</Course>
<Course>
TBUS 301 Quantitative Analysis for Business
</Course>
</EnrolledIn>
</Student>
<Student>
<LastName> Smith </LastName>
<FirstName>Amy</FirstName>
<EnrolledIn>
Courses enrolled in:
<Course>
TBUS 100 Introduction to Business
</Course>
</EnrolledIn>
</Student>
<Student>
<LastName> Doe </LastName>
<MiddleInitial> L. </MiddleInitial>
<FirstName>Jane</FirstName>
</Student>
</Students>
No comments:
Post a Comment