Organization of This Book

Part I

Chapter 1

This chapter explores XML validation, what schema languages do, and what makes RELAX NG unique.

Chapter 2

This chapter introduces the background of RELAX NG itself and explores the notion of a pattern, the elementary building block on which the whole language is built.

Chapter 3

This chapter builds, step by step, a first complete RELAX NG schema using XML syntax.

Chapter 4

XML syntax is very useful, but it is also verbose. This chapter introduces an alternative, a compact (non-XML) syntax.

Chapter 5

Chapter 3s schema followed the structure of an instance document to create what is called a Russian doll design. In this chapter, I show how named patterns can limit the depth of a schema, provide reusability, and mimic DTD structures.

Chapter 6

Up to now, I’ve described only ordered sequences of elements. This chapter introduces new compositors for defining choices between patterns.

Chapter 7

This chapter introduces the mechanisms that constrain text values and the two datatypes (string and token) built into RELAX NG.

Chapter 8

This chapter describes external datatype libraries that may be used in RELAX NG schemas, and spends some time exploring the two datatype libraries that are most frequently used: the W3C XML Schema library and the DTD compatibility library.

Chapter 9

This chapter explores one of the most powerful aspects of datatypes, the pattern facet of the W3C XML Schema datatype library, and its particular flavor of regular expressions.

Chapter 10

Building on previous chapters, this chapter shows how to reuse and redefine the information in grammars that can be merged.

Chapter 11

This chapter provides a brief explanation of XML namespaces and how RELAX NG supports their use.

Chapter 12

This chapter covers the extensibility of schemas themselves and of the class of instance documents described by a schema.

Chapter 13

Schema annotations are useful both for documentation targeted to human users and to provide additional information to software. This chapter explores annotations and their applications, including projects such as embedding Schematron rules in RELAX NG schemas, Bob DuCharme’s schema document pipeline proposal, and my own XVIF.

Chapter 14

This chapter explores how to generate RELAX NG from different sources, including instance documents (Examplotron), UML diagrams, spreadsheets, and literate programming.

Chapter 15

This chapter goes into the details of the simplification of RELAX NG schemas performed by RELAX NG processors. These details explain some obscure limitations.

Chapter 16

One strength of RELAX NG is that it allows the creation of nondeterministic schemas. While this is extremely convenient for validation purposes, it creates issues for datatype assignment. This chapter examines schema determinism and ambiguity and their impact on the different uses of RELAX NG.

Part II

Chapter 17

This chapter describes all the elements of the XML syntax with descriptions, synopses, and examples.

Chapter 18

This chapter covers the components of the compact syntax, including descriptions, synopses, and examples.

Chapter 19

This chapter describes W3C XML Schema datatypes, often used as an external datatype library in RELAX NG schemas.

Part III

Appendix A

This appendix presents the ISO DSDL project, which includes RELAX NG as its Part 2.

Appendix B

This book is being made available under the GNU Free Documentation License, which provides certain freedoms related to copying, modifying, and distributing this book. This appendix contains pointers to the online version of the book (which includes additional examples and errata), as well as the text of the license.

Glossary

This glossary provides a concise explanation of terms used throughout the book.

Get RELAX NG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.