Version 2.1 (2013 Mar 28), specified title of Module 11.
Version 2.0 (2013 Mar 22), revised for Spring 2013.
Due dates: See Oncourse Modules and Assignments. Turn in through Oncourse Assignments.
Two parts:
Part One: 30 points (up to 35 with extra features)
Part Two: 30 points (up to 35 with extra features)
Students completing this assignment should be able to:
xmlwf or xmllint.xmllint.This lab has two parts. In Part One, you will create an XML document describing a restaurant, with particular attention to its menu or menus, and verify that the document is well-formed XML. In Part Two, you will develop a RELAX NG document schema for restaurant XML documents, and use it to validate the document created in Part One.
Basic knowledge of XML, as covered in Module 10, “Introduction to XML” (in Oncourse; or Chapters 1, 2, and 3 of the textbook and the notes on XML Introduction and Comments, Characters, Entities, Notations.
Create an XML document describing a restaurant and its menu(s). Verify that the document is well-formed.
These are the general requirements for any restaurant XML document. They pertain to document structure. These requirements are relevant to both Part One and Part Two of this assignment.
A restaurant must have a name, address, and telephone number.
It must have at least one menu, and each menu must have a title (for example, “Luncheon Menu,” or just “Menu” if there is only one).
A menu must have one or more sections, with titles, such as Appetizers, Salads, Sandwiches, Seafood, Desserts, Wine List.
Each section must have one or more items of food or drink that a customer can order.
Each item must have a name and price and may have a description.
These are the additional requirements for the particular restaurant XML document that you will turn in for Part One of this assignment. They pertain to the document’s content—not its structure, but how you fill that structure. They are irrelevant to Part Two.
The restaurant must have at least three (3) sections.
At least one menu title, section title, or item name must include a foreign (non-ASCII) character. (Let’s have some exotically named foods and drinks!) Be sure to declare a suitable encoding in your XML declaration.
The restaurant must have at least ten (10) items of food and/or drink.
Since the menu is going to make an impression on customers, it should be well written, with proper spelling, grammar, punctuation, etc.
Check that the document is well-formed XML, using xmlwf, xmllint, or equivalent tools. If your restaurant document is not well-formed, fix it.
You may include extra features such as notes at the beginning or end of sections, or other features that you see or would like to see in restaurant menus.
You can use gucharmap to pick Unicode characters, or if you find the name of a foreign dish on the web, just copy and paste it into your XML document.
$ gucharmap &How to run xmlwf and xmllint and interpret their output (or the absence of any output) is covered in Lecture 18, in Module 10, “Introduction to XML,” in Oncourse.
BASE TOTAL: 30 points
Extra features, if described in “submitted text,” may earn up to 5 extra points, for a total of 35.
Define a RELAX NG schema for restaurant XML documents and validate the document (the one you created in Part One) according to the schema. The schema must codify the Structural Requirements given in Part One; it should not codify the Content Requirements.
Use the file extension “.rnc” for RELAX NG compact syntax (preferred), or “.rng” for RELAX NG XML syntax.
Use Jing (recommended), xmllint, or equivalent tools for validation.
If your restaurant document is not valid, you must fix it!
If you provided extra features in Part One, or you would like to do so now, make sure they are also specified in the RELAX NG schema (either as required or optional document structure).
It will be easier—for you and for me—to do this using the compact syntax for RELAX NG. If you use the compact syntax, validate with Jing; xmllint will work only with the XML syntax.
On merlin, there are two scripts, jing and jinc, in the /home/info/bin directory to make it easy for you to use Jing.
Using the compact syntax:
$ /home/info/bin/jing -c RNCFile XMLFile
or
$ /home/info/bin/jinc RNCFile XMLFile
where RNCFile is the RELAX NG schema file with compact syntax, with the file extension “.rnc”, and XMLFile is the document you want to validate.
Using the XML syntax:
$ /home/info/bin/jing RNGFile XMLFile
where RNGFile is the RELAX NG schema file with XML syntax, with the file extension “.rng”, and XMLFile is the document you want to validate.
If you are going to use Jing, but not merlin, then you may need to read the Jing documentation.
BASE TOTAL: 30 points
Extra features, if described in “submitted text” and present in both the schema and the document, may earn up to 5 extra points, for a total of 35.