by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Tutorial

Table of Contents

1. What RELAX NG Offers
1.1. Diversity
1.2. Keeping Documents Independent of Applications
1.3. Validation Has Many Aspects
1.4. The Best Way to Validate XML Document Structures
1.5. RELAX NG's Diverse Applications
1.6. RELAX NG as a Pivot Format
1.7. Why Use Other Schema Languages?
2. Simple Foundations Are Beautiful
2.1. Documents and Infosets
2.2. Different Types of Schema Languages
2.3. A Simple Example
2.4. A Strong Mathematical Background
2.5. Patterns, and Only Patterns
3. First Schema
3.1. Getting Started
3.2. First Patterns
3.2.1. The text Pattern
3.2.2. The attribute Pattern
3.2.3. The element Pattern
3.2.4. The optional Pattern
3.2.5. The oneOrMore Pattern
3.2.6. The zeroOrMore Pattern
3.3. Complete Schema
3.3.1. Constraining Number of Occurrences
3.3.2. Creating "Russian Doll" Schemas
4. Introducing the Compact Syntax
4.1. First Compact Patterns
4.1.1. The text Pattern
4.1.2. The attribute Pattern
4.1.3. Element
4.1.4. The optional Pattern
4.1.5. The oneOrMore Pattern
4.1.6. The zeroOrMore Pattern
4.2. Full Schema
4.3. XML or Compact?
5. Flattening the First Schema
5.1. Defining Named Patterns
5.2. Referencing Named Patterns
5.3. The grammar and start Elements
5.4. Assembling the Parts
5.5. Problems That Never Arise
5.6. Recursive Models
5.7. Escaping Named Pattern Identifiers in the Compact Syntax
6. More Complex Patterns
6.1. The group Pattern
6.2. The interleave Pattern
6.3. The choice Pattern
6.4. Pattern Compositions
6.5. Order Variation as a Source of Information
6.6. Text and Empty Patterns, Whitespace, and Mixed Content
6.7. Why Is It Called interleave?
6.8. Mixed Content Models with Order
6.9. A Restriction Related to interleave
6.10. A Missing Pattern: Unordered Group
7. Constraining Text Values
7.1. Fixed Values
7.2. Co-Occurrence Constraints
7.3. Enumerations
7.4. Whitespace and RELAX NG Native Datatypes
7.5. Using String Datatypes in Attribute Values
7.6. When to Use String Datatypes
7.7. Using Different Types in Each Value
7.8. Exclusions
7.9. Lists
7.10. Data Versus Text
8. Datatype Libraries
8.1. W3C XML Schema Type Library
8.1.1. The Datatypes
8.1.2. Facets
8.2. DTD Compatibility Datatypes
8.3. Which Library Should Be Used?
8.3.1. Native Types Versus W3C XML Schema Datatypes
8.3.2. DTD Versus W3C XML Schema Datatypes
9. Using Regular Expressions to Specify Simple Datatypes
9.1. A Swiss Army Knife
9.2. The Simplest Possible Pattern Facets
9.3. Quantifying
9.4. More Atoms
9.4.1. Special Characters
9.4.2. Wildcard
9.4.3. Character Classes
9.4.4. Or-ing and Grouping
9.5. Common Patterns
9.5.1. String Datatypes
9.5.2. Numeric and Float Types
9.5.3. Datetimes
10. Creating Building Blocks
10.1. Using External References
10.1.1. With Russian Doll Schemas
10.1.2. With Flat Schemas
10.1.3. Embedding Grammars
10.1.4. Referencing Patterns in Parent Grammars
10.2. Merging Grammars
10.2.1. Merging Without Redefinition
10.2.2. Merging and Replacing Definitions
10.2.3. Combining Definitions
10.2.4. Why Can't Definitions Be Defined by Group?
10.3. A Real-World Example: XHTML 2.0
10.4. Other Options
10.4.1. A Possible Use Case
10.4.2. XML Tools
10.4.3. Text Tools
11. Namespaces
11.1. A Ten-Minute Guide to XML Namespaces
11.2. The Two Challenges of Namespaces
11.3. Declaring Namespaces in Schemas
11.3.1. Using the Default Namespace
11.3.2. Using Prefixes
11.4. Accepting Foreign Namespaces
11.4.1. Constructing a Wildcard
11.4.2. Using Wildcards
11.4.3. Where Should Foreign Nodes Be Allowed?
11.4.4. Traps to Avoid
11.4.5. Adding Foreign Nodes Through Combination
11.5. Namespaces, Building Blocks, and Chameleon Design
11.5.1. Reexamining XHTML 2.0
11.5.2. Putting a Chameleon in the Library
11.5.3. Good Chameleon or Evil Chameleon?
12. Writing Extensible Schemas
12.1. Extensible Schemas
12.1.1. Working from a Fixed Result
12.1.2. Free Formats
12.1.3. Restricting Existing Schemas
12.2. The Case for Open Schemas
12.2.1. More Name Classes
12.3. Extensible and Open?
13. Annotating Schemas
13.1. Common Principles for Annotating RELAX NG Schemas
13.1.1. Annotation Using the XML Syntax
13.1.2. Annotations Using the Compact Syntax
13.1.3. Annotating Groups of Definitions
13.1.4. Alternatives and Workarounds
13.2. Documentation
13.2.1. Comments
13.2.2. RELAX NG DTD Compatibility Comments
13.2.3. XHTML Annotations
13.2.4. DocBook Annotations
13.2.5. Dublin Core Annotations
13.2.6. SVG Annotations
13.2.7. RDDL Annotations
13.3. Annotation for Applications
13.3.1. Annotations for Preprocessing
13.3.2. Annotations for Conversion
13.3.3. Annotations for Extension
14. Generating RELAX NG Schemas
14.1. Examplotron: Instance Documents as Schemas
14.1.1. Ten-Minute Guide to Examplotron
14.1.2. Use Cases
14.2. Literate Programming
14.2.1. Out of the Box
14.2.2. Adding Bells and Whistles for RDDL
14.3. UML
14.4. Spreadsheets
15. Simplification and Restrictions
15.1. Simplification
15.1.1. Annotation Removal, Whitespace and Attribute Normalization, and Inheritance
15.1.2. Retrieval of External Schemas
15.1.3. Name Class Normalization
15.1.4. Pattern Normalization
15.1.5. First Set of Constraints
15.1.6. Grammar Merge
15.1.7. Schema Flattening
15.1.8. Final Cleanup
15.2. Restrictions
15.2.1. Constraints on Attributes
15.2.2. Constraints on Lists
15.2.3. Constraints on Except Patterns
15.2.4. Constraints on Start Patterns
15.2.5. Constraints on Content Models
15.2.6. Limitations on interleave
16. Determinism and Datatype Assignment
16.1. What Is Ambiguity?
16.1.1. Ambiguity Versus Determinism
16.1.2. Different Kinds of Ambiguity
16.2. The Downsides of Ambiguous and Nondeterministic Content Models
16.2.1. Instance Annotations
16.2.2. Compatibility with W3C XML Schema
16.3. Some Ideas to Make Disambiguation Easier
16.3.1. Generalizing the Except Pattern
16.3.2. Making Disambiguation Rules Explicit
16.3.3. Accepting Ambiguity

This text is released under the Free Software Foundation GFDL.