Basic XML Schema Declarations - dummies

Basic XML Schema Declarations

By Lucinda Dykes, Ed Tittel

Part of XML For Dummies Cheat Sheet

An XML Schema document is built of a series of declarations, which gives very detailed information and makes sure the information contained in the XML document is in the correct form.

Declaration Name Purpose Syntax
Schema Identifies the language the schema uses <xsd:schema
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
Element Defines an element <xsd:element name=”name”>
Attribute Defines an attribute <xsd:attribute name=”name”
type=”type”>
Complex type Defines an element that contains other elements, contains
attributes, or contains mixed content (elements and text)
<xsd:complexType>
Simple type Creates a constrained datatype for an element or attribute
value
<xsd:simpleType>
Sequence compositor Specifies that attributes or elements within a complex type
must be listed in order
<xsd:sequence>
Choice compositor Specifies that any one of the attributes or elements within a
complex type can be used
<xsd:choice>
All compositor Specifies that any or all attributes or elements within a
complex type can be used
<xsd:all>
Annotation Contains documentation and/or appInfo elements that provide
additional information and comments about the schema document
<xsd:annotation>
Documentation Provides human-readable information within an annotation <xsd:documentation>
Application information Provides computer-readable information within an
annotation
<xsd:appInfo>