ITWissen.info - Tech know how online

regular language for XML, new generation (Relax NG)

Relax NG stands for Regular Language for XML, New Generation and identifies a so-called schema language for XML that describes the structure of an XML document. Relax NG is grouped next to the Document Type Definition( DTD) and the XML Schema standardized by the World Wide Web Consortium(W3C). Relax NG evolved from the two schema languages Relax Core and Trex, which however did not find the widespread use as Relax NG. Originally Relax NG was developed by James Clark and Murata Makoto.

The central feature of Relax NG is that it is a pattern-based schema language. Relax NG is specified by the Organization for the Advancement of Structured Information Standards( OASIS) and also belongs to the ISO/ IEC 19757-2 standard within the Document Schema Definition Languages (DSDL). Relax NG sees itself as a lightweight language that includes an XML-compliant - but also a very compact - syntax. This means that the schemas can be edited with any XML editor.

The development of Relax NG

The background for the development of the schema language Relax NG was to eliminate the disadvantages of the DTD and the XML schema presented by the W3C.

  • DTD documents are not XML-compliant and a new notation must be fundamentally observed.
  • XML Schema is heavyweight, i.e. the language is very extensive, has many restrictions and rules and is therefore laborious to use.

In comparison, Relax NG is a lightweight language, since the restrictions known from the XLM schema are omitted. In addition, Relax NG uses the notation of XML to represent schemas. The language supports a simple concept, and most components of a structure are treated the same. Other features of Relax NG that go beyond the DTD, for example, are:

  • Different data types are supported.
  • Attributes are integrated into content models.
  • XML namespaces are supported.
  • Support for unordered content.
  • Context-sensitive content models are observed.

Of course, Relax NG is based on a grammar, just like the DTD and XML Schema - what is remarkable in this context, however, is that Relax NG is based on a solid mathematical foundation. The mathematical model is the so-called Hedge Automata Theory. This model defines a hedge that is built from a series of trees. In XML terminology, a hedge is a set of elements, for example, an XML document is a hedge. This means that an XML document can be represented figuratively as a formal entity that can be generated by supporting formal tools - similar to a hedge automaton in a regular grammar.

At its core, Relax NG assumes that "everything is a pattern" in general, and defines the most important atomic patterns for this purpose: elements, attributes, and text nodes. These are represented by the constructs:

... ... Through the mechanism of composition, for example, ordered and unordered lists or alternatives can be built. Thereby patterns are named with so-called named patterns, which can then be reused by references. Relax NG is based on the building block principle as well as the reusability of code, so that external Relax NG files can be imported and used as parts of a pattern. Thus, a Relax NG schema may be designed only once, may be referenced in further schemas, and this new schema will then be more compact and concise. The composition mechanisms support the construction of custom patterns in many ways - among others, the construction of non-deterministic patterns is also supported, which is not possible with the W3C XML Schema, for example.
Informations:
Englisch: regular language for XML, new generation - Relax NG
Updated at: 29.10.2013
#Words: 578
Links: document, document type definition (XML) (DTD), online application interactive software (OASIS), international organization for standardization (ISO), international electrotechnical commission (IEC)
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024