Reputation: 823
I am provided a XML file and I am suppose to write DTD for the data set.
This is a snippet of the part I am struggling with.
<Course Number="CS124" Prerequisites="CS107 CS109" Instructors="DJ" Enrollment="60">
<Title>From Languages to Information</Title>
<Description>
Natural language processing. Cross-listed as
<Courseref Number="LING180"/>
.
</Description>
</Course>
<Course Number="CS143" Prerequisites="CS107" Instructors="AA" Enrollment="90">
<Title>Compilers</Title>
<Description>
Principles and practices for design and implementation of compilers and interpreters.
</Description>
</Course>
What is the correct way to make the DTD fit the XML, when there is PCDATA in the element, but also optionally a other ELEMENT? (See ELEMENT Description)
I thought something like this would work:
<!ELEMENT Description ((#PCDATA | Courseref)*)>
But then I get a parse error:
ContentDecl : Name or '(' expected
What is the correct way to write out the DTD for this this XML to be valid?
Upvotes: 0
Views: 598
Reputation: 597941
You have too many parentheses:
<!ELEMENT Description (#PCDATA | Courseref)*>
Upvotes: 1