hi guys im very very new to XML and DTD's im trying to work through a work sheet and i have to validate my XML file which includes an internal DTD
the worksheet wanted me to create a DTD and should assume that all occurring attributes are mandatory, have i done this right? and can you please help me fix the error thank you
below is the validation error what does this mean:
1 ERROR FOUND:
26: 14 The content of element type "teaching" must match "(course)".
XML document:
Code:
1 <?xml version="1.0" ?>
2 <!DOCTYPE lecturers [
3 <!ELEMENT lecturers (lecturer)>
4 <!ELEMENT lecturer (name)>
5 <!ELEMENT name (teaching, research)>
6 <!ELEMENT teaching (course)>
7
8 <!ATTLIST name title CDATA #REQUIRED>
9 <!ATTLIST name first CDATA #REQUIRED>
10 <!ATTLIST name last CDATA #REQUIRED>
11
12 <!ELEMENT course (#PCDATA)>
13 <!ATTLIST course code CDATA #REQUIRED>
14
15 <!ELEMENT research (#PCDATA)>
16
17 ]>
18 <lecturers>
19 <lecturer>
20 <name title="Professor" first="Peter" last="Quirk">
21 <teaching>
22 <course code="CO3070">XML and the Web</course>
23 <course code="CO3300">
24 Web Server Architectures
25 </course>
26 </teaching>
27 <research>
28 The application of Web protocols to Biology
29 </research>
30 </name>
31 </lecturer>
32 </lecturers>
SOLVED i SOLVED IT AFTER 6HOURS if any one else is stuck on this you will need to add * within your parent element of your child which the error is caused for example <!ELEMENT teaching (course)> this will translate to <!ELEMENT teaching (course*)>