RELAX NG compact syntax is a non-XML format inspired by extended Backus-Naur form and regular expressions, designed so that it can be unambiguously translated to its XML counterpart, and back again, with one-to-one correspondence in structure and meaning, in much the same way that Simple Outline XML (SOX) relates to XML. It shares many features with the syntax of DTDs.
In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on Murata Makoto's RELAX and James Clark's TREX.
A RELAX NG schema specifies a pattern for the structure and content of an XML document.
A RELAX NG schema is itself an XML document; however, RELAX NG also offers a popular compact, non-XML syntax.
Compared to other popular schema languages, RELAX NG is relatively simple.
It was defined by a committee specification of the OASIS RELAX NG technical committee in 2001 and 2002, and also by part two of the international standard ISO/IEC 19757: Document Schema Definition Languages (DSDL).
ISO/IEC 19757-2 was developed by ISO/IEC JTC1/SC34 (ISO/IEC Joint Technical Committee 1, Subcommittee 34 - Document description and processing languages) and published in its first version in 2003.
Suppose we want to define an extremely simple markup scheme for a book: a book is defined as a sequence of one or more pages; each page contains text only.
Here is the compact form of the above scenario:
element book
{
element page { text }+
}
With named patterns, this can be flattened to:
start = element book { page+ }
page = element page { text }
A compact RELAX NG parser will treat these two as the same pattern.
See also: