Definitive XML Schema
Priscilla Walmsley (pwalmsley@datypic.com)
ISBN: 0132886723
2nd edition, , Prentice Hall PTR.
Table of contents
- Chapter 1: Schemas: An introduction
- 1.1 What is a schema?
- 1.2 The purpose of schemas
- 1.2.1 Data validation
- 1.2.2 A contract with trading partners
- 1.2.3 System documentation
- 1.2.4 Providing information to processors
- 1.2.5 Augmentation of data
- 1.2.6 Application information
- 1.3 Schema design
- 1.3.1 Accuracy and precision
- 1.3.2 Clarity
- 1.3.3 Broad applicability
- 1.4 Schema languages
- 1.4.1 Document Type Definition (DTD)
- 1.4.2 Schema requirements expand
- 1.4.3 W3C XML Schema
- 1.4.4 Other schema languages
- 1.4.4.1 RELAX NG
- 1.4.4.2 Schematron
- Chapter 2: A quick tour of XML Schema
- 2.1 An example schema
- 2.2 The components of XML Schema
- 2.2.1 Declarations vs. definitions
- 2.2.2 Global vs. local components
- 2.3 Elements and attributes
- 2.3.1 The tag/type distinction
- 2.4 Types
- 2.4.1 Simple vs. complex types
- 2.4.2 Named vs. anonymous types
- 2.4.3 The type definition hierarchy
- 2.5 Simple types
- 2.5.1 Built-in simple types
- 2.5.2 Restricting simple types
- 2.5.3 List and union types
- 2.6 Complex types
- 2.6.1 Content types
- 2.6.2 Content models
- 2.6.3 Deriving complex types
- 2.7 Namespaces and XML Schema
- 2.8 Schema composition
- 2.9 Instances and schemas
- 2.10 Annotations
- 2.11 Advanced features
- 2.11.1 Named groups
- 2.11.2 Identity constraints
- 2.11.3 Substitution groups
- 2.11.4 Redefinition and overriding
- 2.11.5 Assertions
- Chapter 3: Namespaces
- 3.1 Namespaces in XML
- 3.1.1 Namespace names
- 3.1.2 Namespace declarations and prefixes
- 3.1.3 Default namespace declarations
- 3.1.4 Name terminology
- 3.1.5 Scope of namespace declarations
- 3.1.6 Overriding namespace declarations
- 3.1.7 Undeclaring namespaces
- 3.1.8 Attributes and namespaces
- 3.1.9 A summary example
- 3.2 The relationship between namespaces and schemas
- 3.3 Using namespaces in schemas
- 3.3.1 Target namespaces
- 3.3.2 The XML Schema Namespace
- 3.3.3 The XML Schema Instance Namespace
- 3.3.4 The Version Control Namespace
- 3.3.5 Namespace declarations in schema documents
- 3.3.5.1 Map a prefix to the XML Schema Namespace
- 3.3.5.2 Map a prefix to the target namespace
- 3.3.5.3 Map prefixes to all namespaces
- 3.1 Namespaces in XML
- Chapter 4: Schema composition
- 4.1 Modularizing schema documents
- 4.2 Defining schema documents
- 4.3 Combining multiple schema documents
- 4.3.1
include
- 4.3.1.1 The syntax of includes
- 4.3.1.2 Chameleon includes
- 4.3.2
import
- 4.3.2.1 The syntax of imports
- 4.3.2.2 Multiple levels of imports
- 4.3.2.3 Multiple imports of the same namespace
- 4.3.1
- 4.4 Schema assembly considerations
- 4.4.1 Uniqueness of qualified names
- 4.4.2 Missing components
- 4.4.3 Schema document defaults
- Chapter 5: Instances and schemas
- 5.1 Using the instance attributes
- 5.2 Schema processing
- 5.2.1 Validation
- 5.2.2 Augmenting the instance
- 5.3 Relating instances to schemas
- 5.3.1 Using hints in the instance
- 5.3.1.1 The
xsi:schemaLocation
attribute - 5.3.1.2 The
xsi:noNamespaceSchemaLocation
attribute
- 5.3.1.1 The
- 5.3.1 Using hints in the instance
- 5.4 The root element
- Chapter 6: Element declarations
- 6.1 Global and local element declarations
- 6.1.1 Global element declarations
- 6.1.2 Local element declarations
- 6.1.3 Design hint: Should I use global or local element declarations?
- 6.2 Declaring the types of elements
- 6.3 Qualified vs. unqualified forms
- 6.3.1 Qualified local names
- 6.3.2 Unqualified local names
- 6.3.3 Using
elementFormDefault
- 6.3.4 Using
form
- 6.3.5 Default namespaces and unqualified names
- 6.4 Default and fixed values
- 6.4.1 Default values
- 6.4.2 Fixed values
- 6.5 Nils and nillability
- 6.5.1 Using
xsi:nil
in an instance - 6.5.2 Making elements nillable
- 6.5.1 Using
- 6.1 Global and local element declarations
- Chapter 7: Attribute declarations
- 7.1 Attributes vs. elements
- 7.2 Global and local attribute declarations
- 7.2.1 Global attribute declarations
- 7.2.2 Local attribute declarations
- 7.2.3 Design hint: Should I use global or local attribute declarations?
- 7.3 Declaring the types of attributes
- 7.4 Qualified vs. unqualified forms
- 7.5 Default and fixed values
- 7.5.1 Default values
- 7.5.2 Fixed values
- 7.6 Inherited attributes
- Chapter 8: Simple types
- 8.1 Simple type varieties
- 8.1.1 Design hint: How much should I break down my data values?
- 8.2 Simple type definitions
- 8.2.1 Named simple types
- 8.2.2 Anonymous simple types
- 8.2.3 Design hint: Should I use named or anonymous types?
- 8.3 Simple type restrictions
- 8.3.1 Defining a restriction
- 8.3.2 Overview of the facets
- 8.3.3 Inheriting and restricting facets
- 8.3.4 Fixed facets
- 8.3.4.1 Design hint: When should I fix a facet?
- 8.4 Facets
- 8.4.1 Bounds facets
- 8.4.2 Length facets
- 8.4.2.1 Design hint: What if I want to allow empty values?
- 8.4.2.2 Design hint: What if I want to restrict the length of an integer?
- 8.4.3
totalDigits
andfractionDigits
- 8.4.4 Enumeration
- 8.4.5 Pattern
- 8.4.6 Assertion
- 8.4.7 Explicit Time Zone
- 8.4.8 Whitespace
- 8.5 Preventing simple type derivation
- 8.6 Implementation-defined types and facets
- 8.6.1 Implementation-defined types
- 8.6.2 Implementation-defined facets
- 8.1 Simple type varieties
- Chapter 9: Regular expressions
- 9.1 The structure of a regular expression
- 9.2 Atoms
- 9.2.1 Normal characters
- 9.2.2 The wildcard escape character
- 9.2.3 Character class escapes
- 9.2.3.1 Single-character escapes
- 9.2.3.2 Multicharacter escapes
- 9.2.3.3 Category escapes
- 9.2.3.4 Block escapes
- 9.2.4 Character class expressions
- 9.2.4.1 Listing individual characters
- 9.2.4.2 Specifying a range
- 9.2.4.3 Combining individual characters and ranges
- 9.2.4.4 Negating a character class expression
- 9.2.4.5 Subtracting from a character class expression
- 9.2.4.6 Escaping rules for character class expressions
- 9.2.5 Parenthesized regular expressions
- 9.3 Quantifiers
- 9.4 Branches
- Chapter 10: Union and list types
- 10.1 Varieties and derivation types
- 10.2 Union types
- 10.2.1 Defining union types
- 10.2.2 Restricting union types
- 10.2.3 Unions of unions
- 10.2.4 Specifying the member type in the instance
- 10.3 List types
- 10.3.1 Defining list types
- 10.3.2 Design hint: When should I use lists?
- 10.3.3 Restricting list types
- 10.3.3.1 Length facets
- 10.3.3.2 Enumeration facet
- 10.3.3.3 Pattern facet
- 10.3.4 Lists and strings
- 10.3.5 Lists of unions
- 10.3.6 Lists of lists
- 10.3.7 Restricting the item type
- Chapter 11: Built-in simple types
- 11.1 The XML Schema type system
- 11.1.1 The type hierarchy
- 11.1.2 Value spaces and lexical spaces
- 11.1.3 Facets and built-in types
- 11.2 String-based types
- 11.2.1
string
,normalizedString
, andtoken
- 11.2.1.1 Design hint: Should I use
string
,normalizedString
, ortoken
?
- 11.2.1.1 Design hint: Should I use
- 11.2.2
Name
- 11.2.3
NCName
- 11.2.4
language
- 11.2.1
- 11.3 Numeric types
- 11.3.1
float
anddouble
- 11.3.2
decimal
- 11.3.3 Integer types
- 11.3.3.1 Design hint: Is it an integer or a string?
- 11.3.1
- 11.4 Date and time types
- 11.4.1
date
- 11.4.2
time
- 11.4.3
dateTime
- 11.4.4
dateTimeStamp
- 11.4.5
gYear
- 11.4.6
gYearMonth
- 11.4.7
gMonth
- 11.4.8
gMonthDay
- 11.4.9
gDay
- 11.4.10
duration
- 11.4.11
yearMonthDuration
- 11.4.12
dayTimeDuration
- 11.4.13 Representing time zones
- 11.4.14 Facets
- 11.4.15 Date and time ordering
- 11.4.1
- 11.5 Legacy types
- 11.5.1
ID
- 11.5.2
IDREF
- 11.5.3
IDREFS
- 11.5.4
ENTITY
- 11.5.5
ENTITIES
- 11.5.6
NMTOKEN
- 11.5.7
NMTOKENS
- 11.5.8
NOTATION
- 11.5.1
- 11.6 Other types
- 11.6.1
QName
- 11.6.2
boolean
- 11.6.3 The binary types
- 11.6.4
anyURI
- 11.6.1
- 11.7 Comparing typed values
- 11.1 The XML Schema type system
- Chapter 12: Complex types
- 12.1 What are complex types?
- 12.2 Defining complex types
- 12.2.1 Named complex types
- 12.2.2 Anonymous complex types
- 12.2.3 Complex type alternatives
- 12.3 Content types
- 12.3.1 Simple content
- 12.3.2 Element-only content
- 12.3.3 Mixed content
- 12.3.4 Empty content
- 12.4 Using element declarations
- 12.4.1 Local element declarations
- 12.4.2 Element references
- 12.4.3 Duplication of element names
- 12.5 Using model groups
- 12.5.1
sequence
groups- 12.5.1.1 Design hint: Should I care about the order of elements?
- 12.5.2
choice
groups - 12.5.3 Nesting of
sequence
andchoice
groups - 12.5.4
all
groups - 12.5.5 Named model group references
- 12.5.6 Deterministic content models
- 12.5.1
- 12.6 Using attribute declarations
- 12.6.1 Local attribute declarations
- 12.6.2 Attribute references
- 12.6.3 Attribute group references
- 12.6.4 Default attributes
- 12.7 Using wildcards
- 12.7.1 Element wildcards
- 12.7.1.1 Controlling the namespace of replacement elements
- 12.7.1.2 Controlling the strictness of validation
- 12.7.1.3 Negative wildcards
- 12.7.2 Open content models
- 12.7.2.1 Open content in a complex type
- 12.7.2.2 Default open content
- 12.7.3 Attribute wildcards
- 12.7.1 Element wildcards
- Chapter 13: Deriving complex types
- 13.1 Why derive types?
- 13.2 Restriction and extension
- 13.3 Simple content and complex content
- 13.3.1
simpleContent
elements - 13.3.2
complexContent
elements
- 13.3.1
- 13.4 Complex type extensions
- 13.4.1 Simple content extensions
- 13.4.2 Complex content extensions
- 13.4.2.1 Extending
choice
groups - 13.4.2.2 Extending
all
groups - 13.4.2.3 Extending open content
- 13.4.2.1 Extending
- 13.4.3 Mixed content extensions
- 13.4.4 Empty content extensions
- 13.4.5 Attribute extensions
- 13.4.6 Attribute wildcard extensions
- 13.5 Complex type restrictions
- 13.5.1 Simple content restrictions
- 13.5.2 Complex content restrictions
- 13.5.2.1 Eliminating meaningless groups
- 13.5.2.2 Restricting element declarations
- 13.5.2.3 Restricting wildcards
- 13.5.2.4 Restricting groups
- 13.5.2.5 Restricting open content
- 13.5.3 Mixed content restrictions
- 13.5.4 Empty content restrictions
- 13.5.5 Attribute restrictions
- 13.5.6 Attribute wildcard restrictions
- 13.5.7 Restricting types from another namespace
- 13.5.7.1 Using
targetNamespace
on element and attribute declarations
- 13.5.7.1 Using
- 13.6 Type substitution
- 13.7 Controlling type derivation and substitution
- 13.7.1
final
: Preventing complex type derivation - 13.7.2
block
: Blocking substitution of derived types - 13.7.3 Blocking type substitution in element declarations
- 13.7.4
abstract
: Forcing derivation
- 13.7.1
- Chapter 14: Assertions
- 14.1 Assertions
- 14.1.1 Assertions for simple types
- 14.1.1.1 Using XPath 2.0 operators
- 14.1.1.2 Using XPath 2.0 functions
- 14.1.1.3 Types and assertions
- 14.1.1.4 Inheriting simple type assertions
- 14.1.1.5 Assertions on list types
- 14.1.2 Assertions for complex types
- 14.1.2.1 Path expressions
- 14.1.2.2 Conditional expressions
- 14.1.2.3 Assertions in derived complex types
- 14.1.3 Assertions and namespaces
- 14.1.3.1 Using
xpathDefaultNamespace
- 14.1.3.1 Using
- 14.1.1 Assertions for simple types
- 14.2 Conditional type assignment
- 14.2.1 The
alternative
element - 14.2.2 Specifying conditional type assignment
- 14.2.3 Using XPath in the
test
attribute - 14.2.4 The
error
type - 14.2.5 Conditional type assignment and namespaces
- 14.2.6 Using inherited attributes in conditional type assignment
- 14.2.1 The
- 14.1 Assertions
- Chapter 15: Named groups
- 15.1 Why named groups?
- 15.2 Named model groups
- 15.2.1 Defining named model groups
- 15.2.2 Referencing named model groups
- 15.2.2.1 Group references
- 15.2.2.2 Referencing a named model group in a complex type
- 15.2.2.3 Using
all
in named model groups - 15.2.2.4 Named model groups referencing named model groups
- 15.3 Attribute groups
- 15.3.1 Defining attribute groups
- 15.3.2 Referencing attribute groups
- 15.3.2.1 Attribute group references
- 15.3.2.2 Referencing attribute groups in complex types
- 15.3.2.3 Duplicate attribute names
- 15.3.2.4 Duplicate attribute wildcard handling
- 15.3.2.5 Attribute groups referencing attribute groups
- 15.3.3 The default attribute group
- 15.4 Named groups and namespaces
- 15.5 Design hint: Named groups or complex type derivations?
- Chapter 16: Substitution groups
- 16.1 Why substitution groups?
- 16.2 The substitution group hierarchy
- 16.3 Declaring a substitution group
- 16.4 Type constraints for substitution groups
- 16.5 Members in multiple groups
- 16.6 Alternatives to substitution groups
- 16.6.1 Reusable
choice
groups - 16.6.2 Substituting a derived type in the instance
- 16.6.1 Reusable
- 16.7 Controlling substitution groups
- 16.7.1
final
: Preventing substitution group declarations - 16.7.2
block
: Blocking substitution in instances - 16.7.3
abstract
: Forcing substitution
- 16.7.1
- Chapter 17: Identity constraints
- 17.1 Identity constraint categories
- 17.2 Design hint: Should I use
ID
/IDREF
orkey
/keyref
? - 17.3 Structure of an identity constraint
- 17.4 Uniqueness constraints
- 17.5 Key constraints
- 17.6 Key references
- 17.6.1 Key references and scope
- 17.6.2 Key references and type equality
- 17.7 Selectors and fields
- 17.7.1 Selectors
- 17.7.2 Fields
- 17.8 XPath subset for identity constraints
- 17.9 Identity constraints and namespaces
- 17.9.1 Using
xpathDefaultNamespace
- 17.9.1 Using
- 17.10 Referencing identity constraints
- Chapter 18: Redefining and overriding schema components
- 18.1 Redefinition
- 18.1.1 Redefinition basics
- 18.1.1.1 Include plus redefine
- 18.1.1.2 Redefine and namespaces
- 18.1.1.3 Pervasive impact
- 18.1.2 The mechanics of redefinition
- 18.1.3 Redefining simple types
- 18.1.4 Redefining complex types
- 18.1.5 Redefining named model groups
- 18.1.5.1 Defining a subset
- 18.1.5.2 Defining a superset
- 18.1.6 Redefining attribute groups
- 18.1.6.1 Defining a subset
- 18.1.6.2 Defining a superset
- 18.1.1 Redefinition basics
- 18.2 Overrides
- 18.2.1 Override basics
- 18.2.1.1 Include plus override
- 18.2.1.2 Override and namespaces
- 18.2.1.3 Pervasive impact
- 18.2.2 The mechanics of overriding components
- 18.2.3 Overriding simple types
- 18.2.4 Overriding complex types
- 18.2.5 Overriding element and attribute declarations
- 18.2.6 Overriding named groups
- 18.2.1 Override basics
- 18.3 Risks of redefines and overrides
- 18.3.1 Risks of redefining or overriding types
- 18.3.2 Risks of redefining or overriding named groups
- 18.1 Redefinition
- Chapter 19: Topics for DTD users
- 19.1 Element declarations
- 19.1.1 Simple types
- 19.1.2 Complex types with simple content
- 19.1.3 Complex types with complex content
- 19.1.4 Mixed content
- 19.1.5 Empty content
- 19.1.6 Any content
- 19.2 Attribute declarations
- 19.2.1 Attribute types
- 19.2.2 Enumerated attribute types
- 19.2.3 Notation attributes
- 19.2.4 Default values
- 19.3 Parameter entities for reuse
- 19.3.1 Reusing content models
- 19.3.2 Reusing attributes
- 19.4 Parameter entities for extensibility
- 19.4.1 Extensions for
sequence
groups - 19.4.2 Extensions for
choice
groups - 19.4.3 Attribute extensions
- 19.4.1 Extensions for
- 19.5 External parameter entities
- 19.6 General entities
- 19.6.1 Character and other parsed entities
- 19.6.2 Unparsed entities
- 19.7 Notations
- 19.7.1 Declaring a notation
- 19.7.2 Declaring a notation attribute
- 19.7.3 Notations and unparsed entities
- 19.8 Comments
- 19.9 Using DTDs and schemas together
- 19.1 Element declarations
- Chapter 20: XML information modeling
- 20.1 Data modeling paradigms
- 20.2 Relational models
- 20.2.1 Entities and attributes
- 20.2.2 Relationships
- 20.2.2.1 One-to-one and one-to-many relationships
- 20.2.2.2 Many-to-many relationships
- 20.3 Modeling object-oriented concepts
- 20.3.1 Inheritance
- 20.3.2 Composition
- 20.4 Modeling web services
- 20.5 Considerations for narrative content
- 20.5.1 Semantics vs. style
- 20.5.1.1 Benefits of excluding styling
- 20.5.1.2 Rendition elements: "block" and "inline"
- 20.5.2 Considerations for schema design
- 20.5.2.1 Flexibility
- 20.5.2.2 Reusing existing vocabularies
- 20.5.2.3 Attributes are for metadata
- 20.5.2.4 Humans write the documents
- 20.5.1 Semantics vs. style
- 20.6 Considerations for a hierarchical model
- 20.6.1 Intermediate elements
- 20.6.2 Wrapper lists
- 20.6.3 Level of granularity
- 20.6.4 Generic vs. specific elements
- Chapter 21: Schema design and documentation
- 21.1 The importance of schema design
- 21.2 Uses for schemas
- 21.3 Schema design goals
- 21.3.1 Flexibility and extensibility
- 21.3.2 Reusability
- 21.3.3 Clarity and simplicity
- 21.3.3.1 Naming and documentation
- 21.3.3.2 Clarity of structure
- 21.3.3.3 Simplicity
- 21.3.4 Support for graceful versioning
- 21.3.5 Interoperability and tool compatibility
- 21.4 Developing a schema design strategy
- 21.5 Schema organization considerations
- 21.5.1 Global vs. local components
- 21.5.1.1 Russian Doll
- 21.5.1.2 Salami Slice
- 21.5.1.3 Venetian Blind
- 21.5.1.4 Garden of Eden
- 21.5.2 Modularizing schema documents
- 21.5.1 Global vs. local components
- 21.6 Naming considerations
- 21.6.1 Rules for valid XML names
- 21.6.2 Separators
- 21.6.3 Name length
- 21.6.4 Standard terms and abbreviations
- 21.6.5 Use of object terms
- 21.7 Namespace considerations
- 21.7.1 Whether to use namespaces
- 21.7.2 Organizing namespaces
- 21.7.2.1 Same namespace
- 21.7.2.2 Different namespaces
- 21.7.2.3 Chameleon namespaces
- 21.7.3 Qualified vs. unqualified forms
- 21.7.3.1 Qualified local names
- 21.7.3.2 Unqualified local names
- 21.7.3.3 Using form in schemas
- 21.7.3.4 Form and global element declarations
- 21.7.3.5 Default namespaces and unqualified names
- 21.7.3.6 Qualified vs. unqualified element names
- 21.7.3.7 Qualified vs. unqualified attribute names
- 21.8 Schema documentation
- 21.8.1 Annotations
- 21.8.2 User documentation
- 21.8.2.1 Documentation syntax
- 21.8.2.2 Data element definitions
- 21.8.2.3 Code documentation
- 21.8.2.4 Section comments
- 21.8.3 Application information
- 21.8.4 Non-native attributes
- 21.8.4.1 Design hint: Should I use annotations or non-native attributes?
- 21.8.5 Documenting namespaces
- Chapter 22: Extensibility and reuse
- 22.1 Reuse
- 22.1.1 Reusing schema components
- 22.1.2 Creating schemas that are highly reusable
- 22.1.3 Developing a common components library
- 22.2 Extending schemas
- 22.2.1 Wildcards
- 22.2.2 Open content
- 22.2.3 Type substitution
- 22.2.4 Substitution groups
- 22.2.5 Type redefinition
- 22.2.6 Named group redefinition
- 22.2.7 Overrides
- 22.1 Reuse
- Chapter 23: Versioning
- 23.1 Schema compatibility
- 23.1.1 Backward compatibility
- 23.1.2 Forward compatibility
- 23.2 Using version numbers
- 23.2.1 Major and minor versions
- 23.2.2 Placement of version numbers
- 23.2.2.1 Version numbers in schema documents
- 23.2.2.2 Versions in schema locations
- 23.2.2.3 Versions in instances
- 23.2.2.4 Versions in namespace names
- 23.2.2.5 A combination strategy
- 23.3 Application compatibility
- 23.4 Lessening the impact of versioning
- 23.4.1 Define a versioning strategy
- 23.4.2 Make only necessary changes
- 23.4.3 Document all changes
- 23.4.4 Deprecate components before deleting them
- 23.4.5 Provide a conversion capability
- 23.5 Versions of the XML Schema language
- 23.5.1 New features in version 1.1
- 23.5.2 Forward compatibility of XML Schema 1.1
- 23.5.3 Portability of implementation-defined types and facets
- 23.5.3.1 Using
typeAvailable
andtypeUnavailable
- 23.5.3.2 Using
facetAvailable
andfacetUnavailable
- 23.5.3.1 Using
- 23.1 Schema compatibility
- Appendix A: XSD keywords
- Appendix B: Built-in simple types