15) Write an XML document that contains the following information: your name. Your email address. Your student number. Your home town. Your date of birth. Choose appropriate tags. Use Attributes for the date of birth.
<?xml version= "1.0''?>
<information>
<information>
<student>
<student dateOfBirth=''01/04/87''>
<name>Nazzy</name>
<email>nw778@live.mdx.ac.uk</email>
<studentno>M00345666</studentno>
<hometown>London</hometown>
</student>
</information>
<student dateOfBirth=''01/04/87''>
<name>Nazzy</name>
<email>nw778@live.mdx.ac.uk</email>
<studentno>M00345666</studentno>
<hometown>London</hometown>
</student>
</information>
15) Have a look at the XML document below. Identify all the syntax errors.
<?xml version= “1.0” ?>
<!DOCTYPE countryCollection SYSTEM "countryList.dtd">
<CountryList>
<Nations TotalNations =”3”/>
<!--Data from CIA --Year Book -->
<Country CountryCode=”1”>
<OfficialName>United States of America</officialName>
<Label>Common Names:</label>
<CommonName>United States</commonName>
<CommonName>U.S.</commonName>
<Label>Capital:</capital>
<Capital cityNum=”1”>Washington, D.C. </label>
<2ndCity cityNum=”2”>New York </2ndCity>
<Label>Major Cities:</label>
<MajorCity cityNum=”3”>Los Angeles </majorCity>
<MajorCity cityNum=”4”>Chicago </majorCity>
<MajorCity cityNum=”5’>Dallas </majorCity>
<Label>Bordering Bodies of Water:</label>
<BorderingBodyOfWater> Atlantic Ocean </borderingBodyOfWater>
<BorderingBodyOfWater> Pacific Ocean </borderingBodyOfWater>
<BorderingBodyOfWater> Gulf of Mexico </borderingBodyOfWater>
<Label>Bordering Countries:</label>
<BorderingCountry CountryCode=”1”> Canada </borderingCountry>
<BorderingCountry CountryCode =”52”> Mexico </borderingCountry>
</country>
<Country CountryCode=”81”>
<OfficialName> Japan </officialName>
<Label>Common Names:</label>
<CommonName> Japan </commonName>
<Label>Capital:</label>
<Capital>Tokyo</capital cityNum=”1”>
<2ndCity cityNum=”2”>Osaka </2ndCity>
<Label>Major Cities:</label>
<MajorCity cityNum=”3”>Nagoya </majorCity>
<MajorCity cityNum=”4”>Osaka </majorCity>
<MajorCity cityNum=”5’>Kobe </majorCity>
<Label>Bordering Bodies of Water:</label>
<BorderingBodyOfWater>Sea of Japan </borderingBodyOfWater>
<BorderingBodyOfWater>Pacific Ocean </borderingBodyOfWater>
</country>
<Country CountryCode=”254”>
<OfficialName> Republic of Kenya </officialName>
<Label>Common Names:</label>
<CommonName> Kenya </commonName>
<Label>Capital:</label>
<Capital cityNum=’1’>Nairobi </capital>
<2ndCity cityNum=’2’>Mombasa</2ndCity>
<Label>Major Cities:</label>
<MajorCity cityNum=’3’>Mombasa </majorCity>
<MajorCity cityNum=’4’>Lamu </majorCity>
<MajorCity cityNum=’5’>Malindi </majorCity>
<MajorCity cityNum=’6’ cityNum=’7’>Kisumu-Kericho </majorCity>
<Label>Bordering Bodies of Water:</label>
<BorderingBodyOfWater <!--Also Lake Victoria --> > Indian Ocean </borderingBodyOfWater>
</country>
Syntax Errors found
- Non matching and mismatched Tags
- An element should not start with a number
- Mixed double and single quotes cannot be used in a single attribute
- Unclosed closing tags
- Comments being placed just before the element
No comments:
Post a Comment