activty 17.1 XML

Description: 

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

<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

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" ?> 
<note>
<to>Tove</to> 
<from>Jani</Ffrom> 
<heading>Reminder</heading> 
<body>Don't forget me this weekend!</body> 
</note>

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>

Challenges:

  • 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