XSD SchemaLesson 97Free preview
XSD Example
This lesson is part of XML · All levels
Summary
The example page summarizes the entire concept of XSD into one complete scheme for the order document: global elements, complex types, mandatory attributes, restrictions, and use of ref. A common pattern is to define the named type first, and then to arrange the global element that wears it. Once the schema is available, the XML document is validated with it so that structural errors are caught from the start.
Key points
- Set the scheme in two stages: the named type, then the global element that wears it.
- Type refers to the data type, ref ref refers to other global elements
- Use="required" is used for the attribute that must exist
- Validation can be done by xsi:schemaLocation on documents or testing tools
- Validation error messages indicate the location and type of violation
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.