Questions tagged [relaxng]

RELAX NG (ISO/IEC 19757-2) is an International Standard schema language for XML. A RELAX NG schema specifies a grammar that a validator can apply to XML documents to determine whether or not they are schema-valid.

RELAX NG is a schema language for XML. A RELAX NG schema specifies a grammar that a validator can apply to XML documents to determine whether or not they are valid.

RELAX NG was invented by James Clark and MURATA Makoto and standardized first at OASIS and subsequently in ISO/IEC JTC 1 as an International Standard, ISO/IEC 19757-2 (available here). It is formally expressed with a strong mathematical basis.

Some features of RELAX NG:

  • Schemas can be expressed using either XML, or a non-XML "compact syntax".

  • Support for pluggable datatype libraries. (Most validators come with support for the datatypes defined by W3C XML Schema.)

  • Ability to specify the start (root) elements for documents.

  • Slightly more sophisticated grammar modelling that that permitted by XML DTDs or W3C XML Schema.

Although enjoying less market share than W3C XML Schema, RELAX NG is popular among markup experts and is used as the schema language of other standards such as ODF, MathML and EPUB.

RELAX NG schemas can be programmatically converted to XML DTDs or W3C XML Schemas using James Clark's free and open source trang utility.

References:

173 questions
6
votes
1 answer

Can I specify the schema location in a RELAX NG compact schema?

I want to use a Relax NG compact schema. Do I specify the .rnc file in the xsi:schemaLocation the way I would for an XSD? I don't want to convert the Relax NG to an XSD because the limitations of XSD that would be a problem in my case.
user994165
  • 9,146
  • 30
  • 98
  • 165
5
votes
1 answer

XML Schema to validate each value in an NMTOKENS attribute list

Given this XML file: ...is it possible to create an XSD key/keyref…
Phrogz
  • 296,393
  • 112
  • 651
  • 745
5
votes
1 answer

It´s possible to use Relax NG in Visual Studio?

I want to build a schema for xml, and for what I´ve searched, Relax NG gives better solutions than xmlSchema (xsd). Is there any way to use it in Visual Studio instead of xmlSchema?
5
votes
1 answer

Maintaining Consistency Between JavaScript and C# Object Models

I'm working on an ASP.NET web application that uses a lot of JavaScript on the client side to allow the user to do things like drag-drop reordering of lists, looking up items to add to the list (like the suggestions in the Google search bar),…
Mark Kanof
  • 1,426
  • 1
  • 11
  • 16
4
votes
1 answer

Allowing additional attributes with Relax NG

I am writing a relax NG schema to validate some XML files. For most of the elements, there are some required attributes, and the instances of this XML schema may also add any extra attributes. For example, here is a valid document :
Raphael Jolivet
  • 3,940
  • 5
  • 36
  • 56
4
votes
2 answers

Why can't I put an xs:all inside a xs:sequence?

I'm still a bit new to XML Schema, and I'm trying to do something that would look like this in Relax NG Compact: test = element test{ element A {text}, element B {text}, (element C {text}? & element D {text}?) } Which means that in the test element…
Wilzy X
  • 43
  • 2
4
votes
1 answer

How to validate XML with RELAXNG?

Why is this XML still valid when changing the integer from id="33426841601" to id="asdf" ? I'm totally new to RELAXNG, but I expect this part of the vendor-provided schema to invalidate it:
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
4
votes
1 answer

RelaxNG compact schema for either/both elements in either order

I am writing a RelaxNG Compact schema for an XML file where the contents of the elements must be exactly one of: In English, either or are allowed once…
Phrogz
  • 296,393
  • 112
  • 651
  • 745
4
votes
2 answers

Relax NG in Eclipse

Is there any free software plugin which adds RelaxNG support to Eclipse? I mean syntax highlighting, showing hints after Ctrl+Space pressed, etc. I have found only some articles about this topic and they are several years old [as of 2013]. They say…
Conpuerus
  • 53
  • 5
4
votes
1 answer

RELAX NG Compact Syntax regular expression support?

Is it possible to define a pattern for text in RELAX NG Compact Syntax in the way Regular Expressions are defined, or, maybe even simpler variations of regular grammar which only has "or" and character classes / sequencing operations? Essentially, I…
user797257
3
votes
3 answers

RelaxNG or XSD schema validation with JavaScript

I'd like to do RelaxNG (preferred) or XSD (if I have to) schema validation in client-side JavaScript. Any good libraries for this? Google finds jsrelaxngvalidator but I'm having trouble getting it running and it seems unmaintained. Target…
lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
3
votes
2 answers

Python - RelaxNG object model generator / parser

Say I have this XML: QEmu-fedora-i686 219200 hvm
Wolkenarchitekt
  • 20,170
  • 29
  • 111
  • 174
3
votes
0 answers

How to generate Java classes from RELAX NG schema

I was trying to implement automatic marshalling and unmarshalling for OPDS directories in Java. I've tried to use Trang to generate .xsd files and then generate Java classes using JAXB2 maven plugin, but the generated XML Schema files were…
3
votes
3 answers

Define an element as non-empty in RelaxNG

I've started using RelaxNG to specify XML message schemas, and using PHP DOMDocument to validate and parse incoming messages, but can't figure out how to define a text node so that it cannot be empty. Example schema:
HorusKol
  • 8,375
  • 10
  • 51
  • 92
3
votes
2 answers

Relaxng schema and XML Schema schema for every XML?

Is there a set of XML documents for which we can formulate a RNG, but not an XML Schema (or the other way round)? Can you give me an example, please?
ivanacorovic
  • 2,669
  • 4
  • 30
  • 46
1
2
3
11 12