As developers know, the beauty of XML is that it is extensible, even to the point that you can invent new elements and attributes as you write XML documents. Then, however, you need to define your changes so that applications will be able to make sense of them and this is where XML schema languages come into play. RELAX NG (pronounced relaxing), the Regular Language Description for XML Core--New Generation is quickly gaining momentum as an alternative to other schema languages. Designed to solve a variety of common problems raised in the creation and sharing of XML vocabularies, RELAX NG is less complex than The W3C's XML Schema Recommendation and much more powerful and flexible than DTDs.
RELAX NG is a grammar-based schema language that's both easy to learn for schema creators and easy to implement for software developers In RELAX NG, developers are introduced to this unique language and will learn a no-nonsense method for creating XML schemas. This book offers a clear-cut explanation of RELAX NG that enables intermediate and advanced XML developers to focus on XML document structures and content rather than battle the intricacies of yet another convoluted standard.
RELAX NG covers the following topics in depth:
Introduction to RELAX NG
Building RELAX NG schemas using XML syntax
Building RELAX NG schemas using compact syntax, an alternative non-XML syntax
Flattening schemas to limit depth and provide reusability
Using external datatype libraries with RELAX NG
W3C XML Schema regular expressions
Writing extensible schemas
Generating schemas form different sources
Determinism and datatype assignment
and much more.
If you're looking for a schema language that's easy to use and won't leave you in a labyrinth of obscure limitations, RELAX NG is the language you should be using. And only O'Reilly's RELAX NG gives you the straightforward information and everything else you'll need to take advantage of this powerful and intelligible language.
Chapter 1 What RELAX NG Offers
Keeping Documents Independent of Applications
Validation Has Many Aspects
The Best Way to Validate XML Document Structures
RELAX NG’s Diverse Applications
RELAX NG as a Pivot Format
Why Use Other Schema Languages?
Chapter 2 Simple Foundations Are Beautiful
Documents and Infosets
Different Types of Schema Languages
A Simple Example
A Strong Mathematical Background
Patterns, and Only Patterns
Chapter 3 First Schema
Chapter 4 Introducing the Compact Syntax
First Compact Patterns
XML or Compact?
Chapter 5 Flattening the First Schema
Defining Named Patterns
Referencing Named Patterns
The grammar and start Elements
Assembling the Parts
Problems That Never Arise
Escaping Named Pattern Identifiers in the Compact Syntax
Chapter 6 More Complex Patterns
The group Pattern
The interleave Pattern
The choice Pattern
Order Variation as a Source of Information
Text and Empty Patterns, Whitespace, and Mixed Content
Why Is It Called interleave?
Mixed Content Models with Order
A Restriction Related to interleave
A Missing Pattern: Unordered Group
Chapter 7 Constraining Text Values
Whitespace and RELAX NG Native Datatypes
Using String Datatypes in Attribute Values
When to Use String Datatypes
Using Different Types in Each Value
Data Versus Text
Chapter 8 Datatype Libraries
W3C XML Schema Type Library
DTD Compatibility Datatypes
Which Library Should Be Used?
Chapter 9 Using Regular Expressions to Specify Simple Datatypes
A Swiss Army Knife
The Simplest Possible Pattern Facets
Chapter 10 Creating Building Blocks
Using External References
A Real-World Example: XHTML 2.0
Chapter 11 Namespaces
A Ten-Minute Guide to XML Namespaces
The Two Challenges of Namespaces
Declaring Namespaces in Schemas
Accepting Foreign Namespaces
Namespaces, Building Blocks, and Chameleon Design
Chapter 12 Writing Extensible Schemas
The Case for Open Schemas
Extensible and Open?
Chapter 13 Annotating Schemas
Common Principles for Annotating RELAX NG Schemas
Annotation for Applications
Chapter 14 Generating RELAX NG Schemas
Examplotron: Instance Documents as Schemas
Chapter 15 Simplification and Restrictions
Chapter 16 Determinism and Datatype Assignment
What Is Ambiguity?
The Downsides of Ambiguous and Nondeterministic Content Models
Some Ideas to Make Disambiguation Easier
Chapter 17 Element Reference
Chapter 18 Compact Syntax Reference
EBNF Production Reference
Chapter 19 Datatype Reference
A Multipart Standard
What DSDL Should Bring You
Appendix The GNU Free Documentation License
GNU Free Documentation License
1. APPLICABILITY AND DEFINITIONS
2. VERBATIM COPYING
3. COPYING IN QUANTITY
5. COMBINING DOCUMENTS
6. COLLECTIONS OF DOCUMENTS
7. AGGREGATION WITH INDEPENDENT WORKS
10. FUTURE REVISIONS OF THIS LICENSE
Addendum: How to use this License for your documents
Eric van der Vlist is the resident expert on XML schema languages on XML.com. He is also a member of the ISO DSDL committee, where standardization work on RELAX NG and related specifications is in progress. Eric is also the author of O'Reilly's XML Schema.
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of RELAX NG is a blood pheasant (Ithaginis cruentus). Unlike other pheasants, the blood pheasant resembles a partridge in size and shape. Its crest is grey, and the male's forehead, face, and throat are red. A female's upper features are more rust-colored. Both males and females have grey to light brown bodies.
The blood pheasant lives in the coniferous forests of the Himalayas, from Nepal through Tibet into northern Burma to northwest China. It lives in flocks of 4-20 in nonbreeding season, up to 40 in winter. Between late April and early May, the female fills a shallow saucer nest of dry twigs lined with leaves with up to 14 eggs. Chicks are born in mid-June and able to follow mother to feed at two days old.
The blood pheasant picks up food with its bill and seldom digs with its claws, although it sometimes jumps up to shrubs to feed. It's considered a good runner but a poor flier. When threatened, it rushes down hills and hides under stones. Because it lives in such remote regions, however, the blood pheasant population remains stable and unthreatened by man. Mary Anne Weeks Mayo was the production editor, and Nancy Wolfe Kotary was the copyeditor for RELAX NG. Reg Aubry and Colleen Gorman provided quality control. Julie Hawks wrote the index.
Emma Colby designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from Cuvier's Animals. Emma produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font.
Melanie Wang designed the interior layout, based on a series design by David Futato. This book was converted by Joe Wizda to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. The tip and warning icons were drawn by Christopher Bing. This colophon was compiled by Mary Anne Weeks Mayo.
I bought this book in Dec 2004 when I was assigned a project to develop XML schemas for a complex set of XML files, and I knew little about XML at the time. This book saved my job: I used its guidance to write complex RELAX NG schemas (using its compact format), that I couldn't have done in the time allotted using the W3C schema format. The author also pointed me to freely available tools to transform my new schemas into other formats where needed. The only disappointment for me was the exciting notice in chapter 14 about a tool to generate RELAX NG schemas from an OpenOffice spreadsheet which was to be available on O'Reilly's site on this page, but I haven't yet found it! Even so, I highly recommend the book, and I have recently turned to it again for help with another project.
Bottom Line Yes, I would recommend this to a friend