CS 130 Lab #8: Designing Data Structures


The purpose of this lab is to develop understanding of and experience with the design of abstract data structrues (in XML) and their transformations (via XSL), especially the specific notion of transformation to duocment structures (HTML). There are three parts to the lab, one which asks you to design a data structure in XML to represent albums and songs, another which asks you to represent a specific music list as an outline-style document, and finally a tabular display of selected songs from the list.

Note that different browsers (FireFox, Internet Explorer, Netscape, etc.) may display things differently I have tested the basic XML and XSL features used here and in the textbook and found that Internet Explorer seems to work best.

Note: you can find the sample files from lecture (galaxies, inhabited planets, atmospheric gasses) at this link. That's the whole folder, just open the files you want in either WordPad (to see the "inner workings" or in Internet Explorer (to see how it looks in a browser).

Designing an XML data structure for music lists

Working in a text editor such as WordPad, you should write a text document (but save it with the ".xml" extension) which describes a music list such as might be found on a typical MP3 player. The list should be structured according to musical genres (e.g., Rock, Pop, Country, Hip-hop, etc.); within each genre there should be a set of albums, each with a:

In addition, each song should have a:

Once you have your structure, you should be able to check it by displaying it in the default "outline" format used for XML documents without a style just by opening it in Internet Explorer. You will want to do this periodically as you work, just to check that your structure is well-formatted.

What sorts of tagging structure should you use? Which things should be tags and which should be attributes? How should things be nested one inside the other? This is really up to you: you should look to the classroom lecture examples for guidance, and try to anticipate the need to extract parts of the data in the later parts of this lab. But there are in some sense no "right" answers: you may design any structure you wish.

What sorts of albums and songs should you include? This is really up to you: just be sure to have fun with it! You can use real artists and albums you know, or make up fun or silly ones (even serious ones, if you really want).

For your final demo, you should have at least 5 albums in at least 3 genres. You can put in just one song for an album, if you like, but at least some albums should have a few songs. At least some of these should have optional information (the "Explicit" lyrics marker).

Some common problems:

Here is a list of some common problems people are having in lab, just to save time (special thanks to all those "guinea pigs" who started the lab already and helped point these out):

Transforming album list data into an outline document

Again working in a text editor such as WordPad, you should write an XSL stylesheet which allows your album list to be displayed in an outline-style format (as for the galaxies example from lecture).

Your design is largely up to you, but it should have at least these features:

Please have your files and pages ready to demo by the end of lab on Monday 24 April.