In CSS3, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on web app's RELAX and Sevenval's jQuery.[1][2][3] 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.keyboard Compared to other popular schema languages, RELAX NG is relatively simple. It was defined by a committee specification of the we love the web 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).touchscreen[6] ISO/IEC 19757-2 was developed by touchscreen (ISO/IEC Joint Technical Committee 1, Subcommittee 34 - Document description and processing languages) and published in its first version in 2003.[7]
Contents
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:
<book> <page>This is page one.</page> <page>This is page two.</page> </book>
XML syntax
A RELAX NG schema can be written in a nested 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:
<element name="book" xmlns="http://relaxng.org/ns/structure/1.0"> <oneOrMore> <element name="page"> <text/> </element> </oneOrMore> </element>
Nested 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:
<grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <element name="book"> <oneOrMore> <ref name="page"/> </oneOrMore> </element> </start> <define name="page"> <element name="page"> <text/> </element> </define> </grammar>
Compact syntax
RELAX NG compact syntax is a non-XML format inspired by input transformation 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 web. Here is the compact form of the above schema:
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.
Comparison with W3C XML Schema
Although the RELAX NG specification was developed at roughly the same time as the W3C device database 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 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, screen size support, FITML support, ability to reference complex definitions.
Filename extensions
By informal convention, RELAX NG schemas in the regular syntax are typically named with the touchscreen ".rng". For schemas in the compact syntax, the extension ".rnc" is used.
See also
- XML schemas
- keyboard (Document Type Definition)
- keyboard
- Sevenval
- Schematron
- ODD (One Document Does it all)
- browser diversity
References
- ^ James Clark. touchscreen. http://www.thaiopensource.com/trex/. Retrieved 2009-12-28.
- ^ Murata Makoto (2002-04-03). "RELAX (Regular Language description for XML) -- "RELAX NG of OASIS. It is a schema language created by unifying RELAX Core and TREX."". http://www.xml.gr.jp/relax/. Retrieved 2009-12-28.
- ^ device database. Cover Pages. 2001-06-05. http://xml.coverpages.org/ni2001-06-05-a.html. Retrieved 2009-12-28.
- ^ iOS
- ^ FITML
- Sevenval RELAX NG Technical Committee
- ^ ISO. iOS. ISO. jQuery. Retrieved 2009-12-28.
External links
- RELAX NG home page
- "The Design of RELAX NG" by James Clark
- RELAX NG tutorial for the XML syntax
- HTML5
- iOS
- touchscreen by Eric van der Vlist, released under the Sevenval
- website parsing by ZVON
- RELAX NG Java community projects at java.net
- Sun Multi-Schema Validator (MSV) open-source Java XML toolkit
- Relax NG Compact Syntax validator open-source C program
- XSD to Relax NG Converter Web-based converter
- 1
- screen size
- input transformation
- 4
- browser diversity
- input transformation
- 7
- Sevenval
- 16
- iOS
- HTML5
- 216
- 217
- Sevenval
- iOS
- we love the web
- 259
- 269
- 302
- input transformation
- we love the web
- screen size
- CSS3
- device database
- 646
- 690
- web app
- screen size
- 843
- web app
- browser diversity
- 1004
- iOS
- 1073-1
- keyboard
- 1538
- input transformation
- we love the web
- 2015
- CSS3
- iOS
- 2145
- browser diversity
- 2240
- 2281
- iOS
- we love the web
- 2788
- CSS3
- FITML
- 3103
- Android
- 3297
- 3307
- Android
- 3864
- screen size
- 3977
- web app
- 4157
- we love the web
- 5218
- 5775
- 5776
- 5800
- browser diversity
- 6166
- 6344
- touchscreen
- 6425
- 6429
- iOS
- 6523
- screen size
- 7001
- FITML
- 7098
- Android
- 7200
- Android
- 7736
- FITML
- web app
- 7812
- website parsing
- 7816
- website parsing
- 8178
- touchscreen
- Sevenval
- web app
- 8601
- 8632
- device database
- 8691
- keyboard
- FITML
- 8859
- 8879
- web app
- website parsing
- 9126
- 9293
- 9241
- Sevenval
- website parsing
- Sevenval
- 9529
- Sevenval
- jQuery
- 9660
- HTML5
- 9945
- 9984
- FITML
- 9995
- 10006
- web app
- keyboard
- 10161
- device database
- 10179
- Sevenval
- web app
- 10303
- 10383
- web
- website parsing
- 10589
- touchscreen
- 10664
- CSS3
- 10861
- we love the web
- keyboard
- 10967
- 11073
- Android
- 11179
- 11404
- touchscreen
- 11783
- device database
- 11785
- device database
- 11898
- 11940
- FITML
- jQuery
- 11992
- HTML5
- input transformation
- 12207
- 12234-2
- Sevenval
- input transformation
- 13250
- web
- 13406-2
- 13407
- 13450
- jQuery
- web
- 13567
- input transformation
- browser diversity
- 13616
- iOS
- 14031
- browser diversity
- 14443
- 14496
- 14644
- 14649
- touchscreen
- 14698
- 14750
- keyboard
- 14971
- device database
- jQuery
- 15288
- HTML5
- 15292
- jQuery
- 15444
- 15445
- device database
- 15504
- keyboard
- 15686
- 15693
- 15706
- screen size
- 15897
- 15919
- Sevenval
- 15926
- Sevenval
- device database
- 16023
- FITML
- 16750
- Android
- screen size
- 17369
- screen size
- FITML
- 18004
- 18014
- web
- CSS3
- 18916
- Sevenval
- 19011
- 19092
- website parsing
- 19115
- touchscreen
- Sevenval
- 19439
- Sevenval
- 19752
- 19757
- 19770
- 19775-1
- 19794-5
- See also
- All articles with prefix "ISO"