References for subject 3
Recommendations:
Tutorials and hints:
Simple types
Current examples are in XML03.zip.
Look at examples in types.xsd. Try to validate the example document.
Check that the constraints are really being checked.
Task 1.
Start with students12.xsd.
- Define a simple type for PESEL.
- Add optional address information to
Person
type (students and teachers).
Define appropriate simple types for address fields (postal code, list of known countries...)
Keys and references
Example definitions can be found in students12.xsd.
Task 2.
Continue working with your version of students12.xsd.
Elements /school/teachers/teacher and /school/students/student contains data of all teachers and students in the school.
In a lecture, elements teacher and registered-students/student should refer to those records.
- Add attributes teacher-id and student-id to the records. (Find TODOs in the schema source.)
- Add the same attributes to the referring elements (which are now empty). (Find TODOs in the schema source.)
- Define appropriate keys and references to make a document consistent.
Target namespace
Task 3.
- Add a target namespace to your schema (you may work on a separate copy of it).
- Make the schema consistent (fix broken references to global elements or types).
- Change the information about schema location in the example document. (Generate a sample document to get a hint from Eclipse).
- Change the document and validate it.
- Fix keys a references, unless you've already done it.
Task 4.
Currently all lectures take place in one building, so it is enough to identify rooms by their numbers.
We want to extend our model to allow more than one building.
- Add building name to room information.
- Change key and keyref definitions, so that rooms are identified by pairs: (building, number).
Adjust
meeting
definition accordingly.