ArticleslgStudy

computer science

RELAX NG

RELAX NG is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand RELAX NG rather than just read about it. In short: 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.

Key takeaways

  • RELAX NG belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect RELAX NG to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of RELAX NG from memory before moving on to harder problems.

Reference excerpt

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. 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 (Tree Regular Expressions for XML), and also by part two of the international standard ISO/IEC 19757: Document Schema Definition Languages (DSDL). ISO/IEC 19757-2 was developed by ISO/IEC JTC 1/SC 34 and published in its first version in 2003.

Comparison with W3C XML Schema

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 many features with W3C XML Schema that set both apart from traditional DTDs: data typing, regular expression support, namespace support, ability to reference complex definitions.

Filename extensions 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 "deterministic" or "unambiguous".

Converting Relax NG to DTD Relax NG schemas can be converted to DTDs by applying Trang which can be found at: [1]. The manual for Trang is located at [2]. 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 XML schemas DTD (Document Type Definition) Document Structure Description XML Schema (W3C) Schematron ODD (One Document Does it all) SXML

References

External links RELAX NG home page "The Design of RELAX NG" by James Clark RELAX NG tutorial for the XML syntax RELAX NG tutorial for the compact syntax Design patterns for structuring XML documents RELAX NG Book by Eric van der Vlist, released under the GNU Free Documentation License Relax NG Reference 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 https://github.com/relaxng/jing-trang

Worked examples

Example 1 — a first encounter with RELAX NG

Start with the simplest possible case. Write down what RELAX NG claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to RELAX NG before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about RELAX NG ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of RELAX NG

In research
RELAX NG appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses RELAX NG in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
RELAX NG is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer-related introductions in 2001, Data modeling languages, ISO/IEC standards, so understanding it makes those chapters shorter.
In everyday life
Look for RELAX NG outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study RELAX NG in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what RELAX NG means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain RELAX NG out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is RELAX NG in simple terms?

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.

Why does RELAX NG matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study RELAX NG?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on RELAX NG.

Tags

  • Computer-related introductions in 2001
  • Data modeling languages
  • ISO/IEC standards
  • XML
  • XML-based standards

Keep exploring