Part 1 (exercise17.xml)
:
This exercise is designed to give you a small taste of how you can use
XML to classify content. All you will be concerned with here is gathering
a little data and classifying it with XML using only tags (not attributes).
For this exercise, pick 5 of your favorite CDs and classify the information
below in XML about those CDs. If you don't happen to have your favorite CD
with you, you can always jump on Amazon and look the data up. For each
CD, include the following data:
- Make the root object in your document <cdcollection>
- Inside the <cdcollection> container, add an <author> container and
insert your name.
- Inside the <cdcollection> container, add a <date> container and insert
the date.
- For each CD, create a <cd> container.
- Within each <cd> include the following:
- Name/title of CD (use <cdname> container)
- Name of artist or group (use <artist> container)
- Type of music (use <musictype> container)
- Create a container for each song (use <song> container, repetatively)
- Inside each song container include the track number of the song (use <trackno>
container)
- Inside each song container include the name of the song (use <name>
container)
Once you are completed, check your file in Internet Explorer 5 or above.
Don't forget: the first line of the file must be:
<?xml version="1.0" ?>
And don't forget to follow the other rules of XML (i.e.: XML Wellformedness constraints)!
Part 2 (exercise17css.xml and mystyles.css):
Using the XML file you just generated (make a copy of it and save it as exercise17css.xml), you will now apply what
you know about CSS by linking an external CSS file to the XML document
to format it. Create an external stylesheet to the following specifications:
Once you have created the external stylesheet, use the following to link
it to your XML document:
<?xml-stylesheet type="text/css" href="mystyles.css"?>