RELAX NG#Compact syntax

{{Short description|XML schema language}}

{{infobox file format

| name = RELAX NG

| extension = .rng

| mime = application/xml, text/xml

| owner =

| genre = XML schema language

| extendedfrom = XML

| standard =

}}

In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML—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 but RELAX NG also offers a popular compact, non-XML syntax.[http://www.oasis-open.org/committees/relax-ng/compact-20021121.html RELAX NG Compact Syntax] Compared to other XML schema languages RELAX NG is considered relatively simple.

It was defined by a committee specification of the OASIS RELAX NG technical committee in 2001 and 2002, based on Murata Makoto's RELAX and James Clark's TREX,{{cite web |url=http://www.thaiopensource.com/trex/ |title=TREX - Tree Regular Expressions for XML - "TREX has been merged with RELAX to create RELAX NG." |author=James Clark |access-date=2009-12-28}}{{cite web |url=http://www.xml.gr.jp/relax/ |title=RELAX (Regular Language description for XML) -- "RELAX NG of OASIS. It is a schema language created by unifying RELAX Core and TREX." |author=Murata Makoto |date=2002-04-03 |access-date=2009-12-28}}{{cite web |url=http://xml.coverpages.org/ni2001-06-05-a.html |title=TREX and RELAX Unified as RELAX NG, a Lightweight XML Language Validation Specification. |publisher=Cover Pages |date=2001-06-05 |access-date=2009-12-28}} and also by part two of the international standard ISO/IEC 19757: Document Schema Definition Languages (DSDL).[http://www.oasis-open.org/committees/relax-ng/spec-20011203.html RELAX NG Specification][http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=relax-ng RELAX NG Technical Committee] ISO/IEC 19757-2 was developed by ISO/IEC JTC 1/SC 34 and published in its first version in 2003.{{cite web |url=https://www.iso.org/standard/52348.html |title=ISO/IEC 19757-2:2008 - Information technology -- Document Schema Definition Language (DSDL) -- Part 2: Regular-grammar-based validation -- RELAX NG |author=ISO |publisher=ISO |access-date=2009-12-28}}

Comparison with W3C XML Schema

{{Main|XML schema languages}}

Although the RELAX NG specification was developed at roughly the same time as the W3C XML Schema specification, the latter was arguably better known and more widely implemented in both open-source and proprietary XML parsers and editors when it became a W3C Recommendation in 2001. Since then, however, RELAX NG support has increasingly found its way into XML software, and its acceptance has been aided by its adoption as a primary schema for popular document-centric markup languages such as DocBook, the TEI Guidelines, OpenDocument, and EPUB.

RELAX NG shares with W3C XML Schema many features that set both apart from traditional DTDs: data typing, regular expression support, namespace support, ability to reference complex definitions.

Filename extensions

{{Unreferenced section|date=September 2019}}

By informal convention, RELAX NG schemas in the regular syntax are typically named with the filename extension ".rng". For schemas in the compact syntax, the extension ".rnc" is used.

Determinism

Relax NG schemas are not necessarily [http://relaxng.org/tutorial-20011203.html#IDAIRZR "deterministic" or "unambiguous".]

Converting Relax NG to DTD

Relax NG schemas can be converted to DTDs by applying Trang which can be found at: [https://github.com/relaxng/jing-trang]. The manual for Trang is located at [http://www.thaiopensource.com/relaxng/trang-manual.html]. Note that Trang is unable to convert the OASIS DITA 1.3 schema to DTDs, failing with messages like:

sorry, combining definitions with combine="choice" is not supported

See also

References

{{reflist}}