Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-04-2012, 09:15 PM   PM User | #1
alishag229
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
alishag229 is an unknown quantity at this point
XML validation with internal DTD

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*)>

Last edited by alishag229; 08-04-2012 at 10:33 PM..
alishag229 is offline   Reply With Quote
Old 08-04-2012, 10:24 PM   PM User | #2
alishag229
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
alishag229 is an unknown quantity at this point
Guys please? i really need help ive been searching the internet for the past 6hours. someone anyone
alishag229 is offline   Reply With Quote
Reply

Bookmarks

Tags
dtd, error, validation, xml

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:25 AM.


Advertisement
Log in to turn off these ads.