Relax NG
Definition
Relax NG is an XML Schema language that represents a sort of compromise between the simplicity of DTDs and the complexity of W3C SML Schema.
The language
- RELAX NG exists in two syntactic versions, an XML syntax and a short syntax.
Example
Copied from the Clark and Murato (2001) RELAX NG Tutorial.
Copyright © The Organization for the Advancement of Structured Information Standards [OASIS] 2001. All Rights Reserved.
This section and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works.Consider a simple XML representation of an email address book: <addressBook> <card> <name>John Smith</name> <email>js@example.com</email> </card> <card> <name>Fred Bloggs</name> <email>fb@example.net</email> </card> </addressBook> The DTD would be as follows: <!DOCTYPE addressBook [ <!ELEMENT addressBook (card*)> <!ELEMENT card (name, email)> <!ELEMENT name (#PCDATA)> <!ELEMENT email (#PCDATA)> ]> A RELAX NG pattern for this could be written as follows: <element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0"> <zeroOrMore> <element name="card"> <element name="name"> <text/> </element> <element name="email"> <text/> </element> </element> </zeroOrMore> </element>
References
- Clark, James and Murata, Makoto (2001), RELAX NG Tutorial
- Clark, James and Murata, Makoto (2001), RELAX NG Specification HTML