Overview

http://www.w3.org/XML/Schema

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."

Notes

Element with empty content (but possibly attributes): http://www.w3.org/TR/xmlschema-0/#emptyContent

http://www.w3.org/XML/2004/xml-schema-test-suite/index.html


This topic: Tech > TechNotes > ProgrammingNotes > XmlNotes > XmlSchemaNotes
Topic revision: r3 - 28 Mar 2008 - TobyCabot
Copyright © 2008-2024 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