Home Page Icon
Home Page
Table of Contents for
Cover
Close
Cover
by Eric van der Vlist
RELAX NG
A Note Regarding Supplemental Files
Foreword by James Clark
Foreword by Murata Makoto
Preface
Who Should Read This Book?
Who Shouldn’t Read This Book?
Organization of This Book
Conventions Used in This Book
Comments and Questions
Powered by WikiML
Acknowledgments
I. Tutorial
1. What RELAX NG Offers
Diversity
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?
2. Simple Foundations Are Beautiful
Documents and Infosets
Different Types of Schema Languages
A Simple Example
A Strong Mathematical Background
Patterns, and Only Patterns
3. First Schema
Getting Started
First Patterns
The text Pattern
The attribute Pattern
The element Pattern
The optional Pattern
The oneOrMore Pattern
The zeroOrMore Pattern
Complete Schema
Constraining Number of Occurrences
Creating “Russian Doll” Schemas
4. Introducing the Compact Syntax
First Compact Patterns
The text Pattern
The attribute Pattern
Element
The optional Pattern
The oneOrMore Pattern
The zeroOrMore Pattern
Full Schema
XML or Compact?
5. Flattening the First Schema
Defining Named Patterns
Referencing Named Patterns
The grammar and start Elements
Assembling the Parts
Problems That Never Arise
Recursive Models
Escaping Named Pattern Identifiers in the Compact Syntax
6. More Complex Patterns
The group Pattern
The interleave Pattern
The choice Pattern
Pattern Compositions
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
7. Constraining Text Values
Fixed Values
Co-Occurrence Constraints
Enumerations
Whitespace and RELAX NG Native Datatypes
Using String Datatypes in Attribute Values
When to Use String Datatypes
Using Different Types in Each Value
Exclusions
Lists
Data Versus Text
8. Datatype Libraries
W3C XML Schema Type Library
The Datatypes
String datatypes
URIs
Qualified names
Binary string-encoded datatypes
Numeric datatypes
Date and time formats
Examples
Facets
DTD Compatibility Datatypes
Which Library Should Be Used?
Native Types Versus W3C XML Schema Datatypes
DTD Versus W3C XML Schema Datatypes
9. Using Regular Expressions to Specify Simple Datatypes
A Swiss Army Knife
The Simplest Possible Pattern Facets
Quantifying
More Atoms
Special Characters
Wildcard
Character Classes
Classical Perl character classes
Unicode character classes
User-defined character classes
Or-ing and Grouping
Common Patterns
String Datatypes
Unicode blocks
Counting words
URIs
Numeric and Float Types
Leading zeros
Fixed format
Datetimes
Time zones
10. Creating Building Blocks
Using External References
With Russian Doll Schemas
With Flat Schemas
Embedding Grammars
Referencing Patterns in Parent Grammars
Merging Grammars
Merging Without Redefinition
Merging and Replacing Definitions
Combining Definitions
Combining by choice
Combining by interleave
Why Can’t Definitions Be Defined by Group?
A Real-World Example: XHTML 2.0
Other Options
A Possible Use Case
XML Tools
Text Tools
11. Namespaces
A Ten-Minute Guide to XML Namespaces
The Two Challenges of Namespaces
Declaring Namespaces in Schemas
Using the Default Namespace
Using Prefixes
Accepting Foreign Namespaces
Constructing a Wildcard
Using Wildcards
Where Should Foreign Nodes Be Allowed?
Traps to Avoid
Adding Foreign Nodes Through Combination
Namespaces, Building Blocks, and Chameleon Design
Reexamining XHTML 2.0
Putting a Chameleon in the Library
Good Chameleon or Evil Chameleon?
12. Writing Extensible Schemas
Extensible Schemas
Working from a Fixed Result
Providing a grammar and a start element
Maximize granularity
Defining named patterns for content rather than for elements
Free Formats
Be cautious with attributes
Use order sparingly
Use containers
Restricting Existing Schemas
The Case for Open Schemas
More Name Classes
Extensible and Open?
13. Annotating Schemas
Common Principles for Annotating RELAX NG Schemas
Annotation Using the XML Syntax
Annotations Using the Compact Syntax
Grammar annotations
Initial annotations
Following annotations
Assembling the annotation syntax
When initial annotations turn into following annotations
Annotating Groups of Definitions
Alternatives and Workarounds
Why reinvent XML 1.0 comments and PIs?
Annotation of value and param patterns
Documentation
Comments
RELAX NG DTD Compatibility Comments
XHTML Annotations
DocBook Annotations
Dublin Core Annotations
SVG Annotations
RDDL Annotations
Annotation for Applications
Annotations for Preprocessing
Annotations for Conversion
Annotations to generate DTDs
Annotations to generate W3C XML Schema
Schema Adjunct Framework
Annotations for Extension
Embedded Schematron rules
XVIF
14. Generating RELAX NG Schemas
Examplotron: Instance Documents as Schemas
Ten-Minute Guide to Examplotron
Use Cases
Literate Programming
Out of the Box
Adding Bells and Whistles for RDDL
UML
Spreadsheets
15. Simplification and Restrictions
Simplification
Annotation Removal, Whitespace and Attribute Normalization, and Inheritance
Retrieval of External Schemas
Name Class Normalization
Pattern Normalization
First Set of Constraints
Grammar Merge
Schema Flattening
Final Cleanup
Restrictions
Constraints on Attributes
Bad example: attribute content model
Bad example: attribute duplication
Bad example: name class overlap
Constraints on Lists
Bad example: list and interleave
Constraints on Except Patterns
Constraints on Start Patterns
Constraints on Content Models
Limitations on interleave
Bad example: more than one text pattern in interleave
16. Determinism and Datatype Assignment
What Is Ambiguity?
Ambiguity Versus Determinism
Different Kinds of Ambiguity
Regular expression ambiguities
Ambiguous regular hedge grammars
Name class ambiguity
Ambiguous datatypes
The Downsides of Ambiguous and Nondeterministic Content Models
Instance Annotations
Compatibility with W3C XML Schema
Some Ideas to Make Disambiguation Easier
Generalizing the Except Pattern
Making Disambiguation Rules Explicit
Accepting Ambiguity
II. Reference
17. Element Reference
Elements
18. Compact Syntax Reference
EBNF Production Reference
19. Datatype Reference
xsd:anyURI — URI (Uniform Resource Identifier)
xsd:base64Binary — Binary content coded as “base64”
xsd:boolean — Boolean (true or false)
xsd:byte — Signed value of 8 bits
xsd:date — Gregorian calendar date
xsd:dateTime — Instant of time (Gregorian calendar)
xsd:decimal — Decimal numbers
xsd:double — IEEE 64-bit floating-point
xsd:duration — Time durations
xsd:ENTITIES — Whitespace-separated list of unparsed entity references
xsd:ENTITY — Reference to an unparsed entity
xsd:float — IEEE 32-bit floating-point
xsd:gDay — Recurring period of time: monthly day
xsd:gMonth — Recurring period of time: yearly month
xsd:gMonthDay — Recurring period of time: yearly day
xsd:gYear — Period of one year
xsd:gYearMonth — Period of one month
xsd:hexBinary — Binary contents coded in hexadecimal
xsd:ID — Definition of unique identifiers
xsd:IDREF — Definition of references to unique identifiers
xsd:IDREFS — Definition of lists of references to unique identifiers
xsd:int — 32-bit signed integers
xsd:integer — Signed integers of arbitrary length
xsd:language — RFC 1766 language codes
xsd:long — 64-bit signed integers
xsd:Name — XML 1.O name
xsd:NCName — Unqualified names
xsd:negativeInteger — Strictly negative integers of arbitrary length
xsd:NMTOKEN — XML 1.0 name token (NMTOKEN)
xsd:NMTOKENS — List of XML 1.0 name tokens (NMTOKEN)
xsd:nonNegativeInteger — Integers of arbitrary length positive or equal to zero
xsd:nonPositiveInteger — Integers of arbitrary length negative or equal to zero
xsd:normalizedString — Whitespace-replaced strings
xsd:NOTATION — Emulation of the XML 1.0 feature
xsd:positiveInteger — Strictly positive integers of arbitrary length
xsd:QName — Namespaces in XML-qualified names
xsd:short — 32-bit signed integers
xsd:string — Any string
xsd:time — Point in time recurring each day
xsd:token — Whitespace-replaced and collapsed strings
xsd:unsignedByte — Unsigned value of 8 bits
xsd:unsignedInt — Unsigned integer of 32 bits
xsd:unsignedLong — Unsigned integer of 64 bits
xsd:unsignedShort — Unsigned integer of 16 bits
III. Appendixes
A. DSDL
A Multipart Standard
Part 1: Overview
Part 2: Regular Grammar-Based Validation
Part 3: Rule-Based Validation
Part 4: Selection of Validation Candidates
Part 5: Datatypes
Part 6: Path-Based Integrity Constraints
Part 7: Character Repertoire Validation
Part 8: Declarative Document Architectures
Part 9: Namespace- and Datatype-Aware DTDs
Part 10: Validation Management
What DSDL Should Bring You
B. The GNU Free Documentation License
GNU Free Documentation License
0. Preamble
1. APPLICABILITY AND DEFINITIONS
2. VERBATIM COPYING
3. COPYING IN QUANTITY
4. MODIFICATIONS
5. COMBINING DOCUMENTS
6. COLLECTIONS OF DOCUMENTS
7. AGGREGATION WITH INDEPENDENT WORKS
8. TRANSLATION
9. TERMINATION
10. FUTURE REVISIONS OF THIS LICENSE
Addendum: How to use this License for your documents
Glossary
Index
About the Author
Colophon
Copyright
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
RELAX NG
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset