XML Schema is used to assess the validity of XML documents. 2 parts:
- local validity: is each element valid?
- overall assessment: are each element and all of its descendants valid?
Schemas are composed of 13 types of schema components in 3 groups (primary, secondary, helper).
- simple type def
- complex type def
- attribute def
- element def
- attribute group def
- id-constraint def
- model group def
- notation declarations
- Helper (these depend on context)
- model groups
- attribute uses
define internal schema components.
are associated by name to info items being validated.
A schema document has a target namespace
(which can be absent). It's the namespace that the schema validates, i.e. it's the namespace that documents must use if they want to be validated by that schema.
Type definitions can be simple or complex. They are hierarchical, and the root of the hierarchy is
, also called the "ur-type." All other types are extensions or restrictions of some other type.
are constraints on strings, i.e. attribute values or text-only elements with no children. They're always a retriction of
. Simple types can also be lists of other simple types or unions of other simple types.
An item of a type that is a restriction of another type "is a" instance of both types.
A Complex type
is a set of attribute definitions and a content type. It can be a restriction of a complex type, or an extension of a simple or complex type, or a restriction of the ur-type. If it extends another complex type it does so by "adding additional content model particles at the end of the other definition's content model, or by having additional attribute declarations, or both."
Element with empty content (but possibly attributes): http://www.w3.org/TR/xmlschema-0/#emptyContent
Copyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding The Caboteria? Send feedback