This document has been updated for the course 2012.
The XML schema specification defines a schema language for XML, i.e., a language for describing the syntax and structure of XML documents. A schema defines what elements, attributes, etc. are permitted in different places of an XML document.
The target of this assignment is to create an XML Schema for a catalog or a library, i.e., a collection of items. For bonus points, you will need to gain some practical experience in other XML-related technologies.
Please follow the general guidelines for assignments (see on the left). In addition, the goals of this particular assignment are to
The schema that you turn in needs to demonstrate your understanding of the following features of XML schemas:
An average student should reserve 10-15 hours for this exercise.
There are three exercises in this assignment. Every exercise is worth 5 points.
Points | Grade |
---|---|
2 | 1 |
4 | 2 |
6 | 3 |
8 | 4 |
10 | 5 |
Please add a directory called assignment_1 into your directory in the SVN repository. Then put the following items (described in general guidelines) into assignment_1.
For this exercise, we accept only Java. You are free to choose your development environment, assuming your code remains compilable and runnable without third party software. We also accept Eclipse projects.
You may not replace those XML parsing functionalities that the Java standard library provides. However, using other tools is mostly allowed. For example, GUI utilities, lightweight database or custom data structures are completely fine. Please ask us first, though, to prevent any disputes. Also remember to mention them in your documentation, including the setup they need.
Create a schema describing your bookshelf. Use the schema features listed in the requirements.
To help defining the problem set, here's how the course assistant describes his shelf. The description is just an example, so please don't hesitate to make your own justifications. Moreover, all the things in the description would not probably work in their literal form in the schema. Use your judgement, what and how to include.
I have two bookshelves and both of them are almost full of books. Some of them are in Finnish, while others are in English or in one of a few other languages. Also their thicknesses vary. A few books include a CD for additional material. The books on the only non-full shelf lean to each other, and the paperbacks haven't liked it so much. Unlike many of the scientific textbooks, the most of the fictional books have only one author. Some of the books amuse me more than the others. Some authors are so magnificient that I have bought complete series of their books. Three of the books are from the library. Mathematics books and physics books are next to each other. I can also remember one book that isn't in the shelf. In fact, I don't know where it is.
Include a documentation where you describe your design by
In addition, provide an example document that corresponds to the schema.
Write a simple program that allows you to list the books in your bookshelf, using an XML document based on your schema as its database (i.e. XML document). In addition, the program should validate the database against the schema. Use the features of Java.
The program should have two features that the user should be able to select from:
We suppose you to have a user interface, which allows the user to define an input file and select the operation. However, the main goals of this section are validating and editing XML documents. Therefore you don't need to pay much attention to the user interface, its purpose is merely a proof of concept. Command line parameters are just enough. You might want to try something like in the following clip:
> java BookShelf shelf.xml validate
shelf.xml is valid.
> java BookShelf shelf.xml list
Adams: Calculus
Rochkind: Advanced UNIX Programming
Your short documentation should describe:
Implement search feature to your bookshelf by allowing the user to define an XPath step (or path). Alternatively, you can provide the user with a few reasonable alternatives, letting user decide only on the search string.