Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Guys please? i really need help ive been searching the internet for the past 6hours. someone anyone


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •