activty 17.1 XML


For a long time, you've added the following line to your XHTML files:

<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

butdo you know what it actually does? We're going to find out in this challenge! It's called a Document Type Declaration (or DTD for short).

copyand past the following to Open XML editor and check that it validates:

<?xmlversion="1.0" ?> 
<body>Don't forget me this weekend!</body> 

Now change the <from> element to <sender> (both the opening and closing tags). Try validating now... even though your XML file is well-formed, does it validate?

Now, consider the following XML file:

<appointment> <date>19/6/2006</date> <time>10:30</time> <name>Jerry Flair</name> <doctor>Sue Flora</doctor> </appointment>


  • Create a DTD for this XML file and test that it works (using the validator).
  • Improved the way Date's are stored in the XML file, and update the DTD accordingly
  • Create a DTD for your XML file that you created in the first assignment of this lesson