ICT-4540 Homework 3b
Purpose
What to Hand In
Hand in your president.xsd XML Schema.
Also, hand in a screenshot confirming that your document was successfully validated.
Problems
- Validating the Presidents with an XML schema
-
Create the file president.xsd and create the elements (and attributes, if any) to represent the content of the file.
Your XSD should represent both the content types, order, and required or optional nature of the elements and attributes. That is, not everything should be xs:string type; dates should be dates and numbers should be the right kind of numbers.
You may select either a flat schema or a Russian Doll schema -- and you must document in your header comment which of these you selected. -
For this part, use restricted sets where applicable, and particularly, use and convert to the standard date format. This will require rewriting the values of these fields in the XML document to validate. -
Add the schema reference to the XML file to associate the xsd with the XML document. -
Validate the document against the schema, saving a screenshot of your successful result.
-
Notes
-
You will find USPresidents.xml in the HWstarters ZIP file -
This exercise is somewhat more time consuming than the DTD exercise. Please plan accordingly. -
When you validate against the XML Schema, you will find one or more missing data items (as with the DTD), and one challenge with data typing. The challenge with data typing can be handled by allowing the item to be omitted. (You may also handle it through a union or other technique you wish to explore).
Identify the problems and correct them. -
It is easier to do validation in an IDE, where this is usually done with one button click.
You can use xmlvalidation.com to perform DTD or schema validation if you have no IDE or desktop tool.
Evaluation
Criteria | Weight |
---|---|
Creation of president.xsd XML schema | 60% |
Updated USPresidents.xml file which associates president.xsd schema | 30% |
Evidence of successful validation of the XML file with the schema | 10% |