Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
9 user(s) are online (9 user(s) are browsing encyclopedia)

Members: 0
Guests: 9

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

RELAX NG

In Computing, RELAX NG (REgular LAnguage for XML Next Generation) is a XML schema language for XML, based on Murata Makoto s RELAX and James Clark (XML_expert) 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 [http://www.oasis-open.org/committees/relax-ng/compact-20021121.html compact, non-XML syntax]. Compared to other popular schema languages, RELAX NG is relatively simple.

It is specified by a [http://www.oasis-open.org/committees/relax-ng/spec-20011203.html committee specification] of the ).

= Schema examples =

Suppose we want to define an extremely simple XML markup scheme for a book: a book is defined as a sequence of one or more pages; each page contains text only. A sample XML document instance might be:

This is page one. This is page two.

== XML syntax ==

A RELAX NG schema can be written in Russian-doll structure by defining a root element that contains further element definitions, which may themselves contain embedded definitions. A schema for our book in this style, using the full XML syntax, would be written:

Russian-doll structure becomes unwieldy with many sublevels and cannot define recursive elements, so most complex RELAX NG schemas use references to named pattern definitions located separately in the schema. Here, a flattened schema defines precisely the same book markup as the previous example:

== Compact syntax ==

RELAX NG compact syntax is a non-XML format designed so that it can be unambiguously translated to its XML counterpart, and back again, with one-to-one correspondence in structure and meaning. It shares many features with the syntax of DTDs. Here is the compact form of the Russian-doll schema:

start = element book { element page { text }+ }

The flattened schema is even shorter in compact form:

start = element book { page+ } page = element page { text }

A RELAX NG parser that accepts the compact syntax (most, but not all, do) will treat this two-line schema as exactly synonomous with its fourteen-line counterpart above.

= Comparison with W3C XML Schemas =

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 commercial 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 docucentric markup languages such as DocBook, the TEI Guidelines, and OpenDocument.

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.

== Features missing from RELAX NG ==

XML Schema natively supports a huge range of built-in and derived datatypes. RELAX NG s built-in type library contains only two datatypes: string and token. However, RELAX NG permits the use of plug-in type libraries, and in practice all RELAX NG implementations support the predefined XML Schema datatypes.

RELAX NG is more limited than XML Schema in its range of occurrence constraints: it has a zeroOrMore constraint and a oneOrMore constraint, but one cannot easily define an arbitrary minimum and maximum occurrence range as with XML Schema s minOccurs and maxOccurs feature. Workarounds are possible, but verbose. The following example demonstrates one way to force the example above to have between two and five page elements:

== Features unique to RELAX NG ==

Besides its compact syntax, which has no standard equivalent in XML Schema, RELAX NG offers several features not present in XML Schema:

  • an operator to define unordered alternatives (the & interleave operator, which was allowed in SGML DTDs but was discarded in the XML DTD model)
  • root elements are explicitly defined (though users are free to permit a choice among more than one)
  • RELAX NG permits nondeterministic content models
  • = See also =

    *Document_Type_Definition (Document Type Definition) *XML Schema *Schematron

    = External links =

    *[http://relaxng.org/ RELAX NG home page] *[http://www.thaiopensource.com/relaxng/design.html The Design of RELAX NG ] by James Clark *[http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html RELAX NG tutorial for the XML syntax] *[http://relaxng.org/compact-tutorial-20030326.html RELAX NG tutorial for the compact syntax] *[http://www.xmlpatterns.com/ Design patterns for structuring XML documents] *[http://www.xml-dev.com:8080/tldp/http%3a//books.xmlschemata.org/relaxng/docbook/book.xml Relax NG XML - The Book] *[http://books.xmlschemata.org/relaxng/ RELAX NG Book] by Eric van der Vlist