T-110.5140 Network Application Frameworks P (5 cr)

XML Schema


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. Apache Xerces is an XML parser with sufficient features for the assignment.

 

Requirements

The goals of this assignment are to

  • Familiarize yourself with XML Schema
  • Understand how types are defined and extended in XML Schema
  • Create reusable XML Schemas


The schema that you turn in needs to use the following features of XML Schema:

  1. Elements and attributes
  2. Extension of complex types
  3. References (ref)
  4. Cardinality constraints
  5. Namespaces
  6. Importing other schemas

For bonus points, include substitution groups, keyrefs and uniqueness into the schema.

The submitted assignment consists of the XML Schema file and an XML document that is valid according to the schema and uses all the features of the defined schema. You also need to validate the XML instance against the schema using the Xerces Java parser from the Apache Group.

 Update! An example java code for validation is in the /usr/share/doc/libxerces-java/examples/sax directory of your virtual machine.