Exercises

  1. Describe the Factory design pattern and state its use.

  2. Write a DTD that describes a CD inventory file. Each CD is either domestic or imported. These details are stored for all CDs: artist, title, price, quantity in stock. Imported CDs also have these fields: country of origin, genre, non-discount status, language, and lead time for reorder. Write some XML instance data describing your five favorite CDs (include a couple of imported CDs, too).

  3. Validate your XML file from the previous question by running it against the DOMEcho program that comes with the Java XML library. In the output you get, explain what the text nodes with a value of “[WS]” are. Hint: Try varying the number of spaces and blank lines in your instance data, and seeing how that changes the output.

  4. Rewrite the DTD describing Shakespearean plays making better use of names, comments, and indenting.

  5. It is possible to implement a DOM parser using a SAX parser, and vice versa, although not particularly efficiently. Write a couple of paragraphs of explanation suggesting how both of these cases might be done.

  6. Write a servlet that reads an XML file of a CD inventory and sends HTML to the browser, putting the data into a table.

  7. Improve the output of the SAXEcho program to make it more presentable and understandable.

  8. Write an application that uses a DOM parser to get CD information and outputs the total number of all kinds of CDs that you have in stock, and the total number by each artist. Remember that some artists may have several titles in print at once.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.51.153