The Caboteria / Tech Web / TechNotes > ProgrammingNotes > XmlNotes / XmlSchemaNotes (28 Mar 2008, TobyCabot)


XML Schema is used to assess the validity of XML documents. 2 parts:

  1. local validity: is each element valid?
  2. 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).

Definition Components define internal schema components.

Declaration 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

Type definitions can be simple or complex. They are hierarchical, and the root of the hierarchy is anyType, also called the "ur-type." All other types are extensions or restrictions of some other type.

Simple types are constraints on strings, i.e. attribute values or text-only elements with no children. They're always a retriction of anySimpleType. 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):

Edit | Attach | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Copyright © 2008-2018 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