Reputation: 519
At a school, there are many classes and the following elements are identified.
Each class teacher holds the following information
Teacher_details section includes the following information
The question is DTD document for the above information
I created the XML and the DTD using VS 2008. But there is an error in the first line of DTD.
<!DOCTYPE school [
<!ELEMENT school (principal|ClassTeacher)*>
<!ELEMENT principal (name,age,address)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT ClassTeacher (cno,td*,nos)>
<!ELEMENT cno (#PCDATA)>
<!ELEMENT td (name,dob)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT dob (#PCDATA)>
<!ELEMENT nos (#PCDATA)>
]>
<school>
<principal>
<name>sdasd</name>
<age>456</age>
<address>jhkh</address>
</principal>
<ClassTeacher>
<cno>456</cno>
<td>
<name>gyj</name>
<dob>fgd</dob>
</td>
<nos>45</nos>
</ClassTeacher>
</school>
Upvotes: 1
Views: 802
Reputation: 86774
The primary issue is that you declare name
twice. Remove one of the declarations to fix the immediate error.
<!ELEMENT school (principal|ClassTeacher)*>
This is a "choice list" of an "element content" declaration, which means school
can have either multiple principal
or multiple ClassTeacher
children but not both. See Element Type Declarations.
Try
<!ELEMENT school (principal, ClassTeacher*)>
This will require that principal
is the first element, followed by any number (including zero) of ClassTeacher
elements.
Upvotes: 1