Questions tagged [relaxng-compact]

RELAX NG compact syntax is a non-XML format inspired by extended Backus-Naur form 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 DTDs.

In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML, based on Murata Makoto's RELAX and James Clark'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 compact, non-XML syntax.
Compared to other popular schema languages, RELAX NG is relatively simple.
It was defined by a committee specification of the OASIS 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).
ISO/IEC 19757-2 was developed by ISO/IEC JTC1/SC34 (ISO/IEC Joint Technical Committee 1, Subcommittee 34 - Document description and processing languages) and published in its first version in 2003.

Suppose we want to define an extremely simple markup scheme for a book: a book is defined as a sequence of one or more pages; each page contains text only.
Here is the compact form of the above scenario:

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.

See also:

22 questions
0
votes
1 answer

How to use a pattern to match element names in compact relaxng

I have some XML that needs validating from external source that has a similar layout too below test test test test I tried the following but it…
Adrian Cornish
  • 23,227
  • 13
  • 61
  • 77
0
votes
1 answer

Why does xjc choke on this RelaxNG compact schema?

I'm trying to use xjc to generate JAXB bindings from the RelaxNG schema of the OpenGL API Registry. It's throwing a NullPointerException: $ xjc -cp jaxb-extra-osgi-2.2.7.jar -relaxng-compact registry.rnc parsing a schema... Exception in thread…
Kevin Krumwiede
  • 9,868
  • 4
  • 34
  • 82
0
votes
2 answers

Validate mixed content containing exactly one text node with RNC

I'm trying to validate a mixed content element which should contain exactly one text node. Eg, this should validate: fff_pre
0
votes
1 answer

In Relax NG, how can I define 2 elements that at least one of is required?

I need to write an xml schema (i'm using relax NG to generate an rng...) that requires at least 1 of 2 diffrent elements. So, if the elements are 'fruit' and 'vegetable', acceptable xml would contain fruit, vegetable, or…
Joel
  • 814
  • 2
  • 9
  • 19
0
votes
1 answer

relax-ng compact: attribute whose name matches a reg-ex

Is there a way in relax-ng to specify that an attribute's name must match a reg-ex. for example the data-attributes in html5. I'm hoping I can do something like... LinkType |= ( …
Paul
  • 5,514
  • 2
  • 29
  • 38
0
votes
1 answer

Making a complex Relax NG attribute without using pattern?

I have an attribute called 'page'. It is made up of two to three doubles, separated by commas, not spaces, with an optional '!' at the end. All of the following are valid: page="8.5,11,3!" page="8.5,11.4,3.1" page="8.5,11!" page="8.5,2.1" I know I…
EdwinW
  • 1,007
  • 2
  • 13
  • 32
-1
votes
1 answer

Input documents againts relax ng

I am currently reading about XML and Relax NG, and I found one question in one notebook which got me confused. The question is: "Explain an application where we have a situation that does not require input documents to be valid (for example against…
scrapy
  • 15
  • 5
1
2