473,416 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Motivation for using either Relax NG or W3C XML Schema

I've read a lot of posts on "why relax ng is so very good" and on "why
w3c xml schema should be the only schema language". I'm, however,
still not clear on why I should prefer one over the other.

I've made a small list of some good and bad points of both. These
points don't really go into the grammar aspects of these languages,
but are more about secondary aspects. The grammar aspects are
different, but both are suitable for validating an XML document. Both
schema languages have good and bad points in them. Any comments on the
languages themselves will therefore (at least in my opinion) not help
to make a choice. However, points like support by tools and how widely
spread the use is (are they both widely used? I don't know this and
haven't been able to find much on it), do make a difference.
W3C XMl Schema
+ versatile: not only useful for validation, but also for
classification of elements and attributes, identifying their
semantics. It can send documentation and application information to
the processor.
+ it employs oop aspects
+ w3c recommendation
+ tools support
- complex
- documentation is hard to understand

Relax NG
+ especially the compact syntax is very clear and intuitive
+ was designed to be able to incorporate elements of other schema
languages (e.g. the data types of w3c schema), which makes it easy to
adapt the language to your needs
+ tool support is slowly expanding
+ draft standard of the Document Description and Processing Languages
subcommittee of the ISO/IEC Joint Technical Committee
- only suitable for validation
- documentation and application information are not supported
- xslt 2.0 is designed to use schemas. From the working draft it seems
that, although every schema language should be supported, w3c xml
schema will be more supported than other schema languages

I don't believe this list is exhaustive or even entirely correct.
However, I hope people on this list can help me make a choice. I
suppose it therefore is useful to explain what the XML Schema will be
used for.
I'm working on a program that generates an XML document which contains
a Java-like programming language. This document should be validated
and then, with the help of XSLT, translated into XMI, which can then,
for instance, be imported into rational rose in order to create class
diagrams.
I suppose that for the validation part both Relax NG and WXS could be
used. However, for the transformation part, they might not be equally
suited. Maybe this is not true, but I just do not know and hope people
on this list can help me.
Some demands for the choice of the schema are that is should be easy
to read and understand, easy to change and easy to maintain.
Jul 20 '05 #1
6 2471
I personally do not prefer RelaxNG over XML Schema nor the other way around.
To me they are both Schema languages that can sort of handle the same
things.

However here are some remarks ...
[*] RelaxNG has a huge XML-Guru support, this should not be
confused with usage.

Here is an indication, we currently advertise on Google and find
that for every hundred searches for 'XML Schema' there is only
one search for RelaxNG.

RelaxNG seems to be (for the moment) the Linux of the XML Schema
languages.
[*] XML Schema/RelaxNG Compact Syntax

What will be next 'XML Compact Syntax'?
[*] 'W3C XML Schema' Validators

There is a 'little' bit of inconsistency in XML Schema Validators
at the moment, however using good coding techniques and a
combination of Xerces and XSV to validate your XML Schema might do
the trick.
[*] Data vs Document ???

One trend seems to be that W3C XML Schema is being used more for data
based applications and RelaxNG more for document based applications.
[*] Conversion

It seems to be possible at the moment to convert (without loss?) from
RelaxNG to XML Schema however not the other way around.

Good luck,
Edwin Dankert
Cladonia Ltd.
http://www.cladonia.com/
Jul 20 '05 #2
I wrote a short comparison a few weeks (or so) back. If there's an archive
for this list you should be able to find it.

Off the top of my head, the Pro list for RELAX NG should contain:

- Can describe ambiguous grammars.
- Can describe content dependencies (e.g., attributes/elements that are
valid based on value of an attribute).
- Grammars are closed under union.
- Trang (the fastest way to write XML Schema is to write it in RNG compact
syntax and convert it).

The Pro list for XML Schema should contain:

- Can describe identity constraints (key, keyRef).
- Great book by Priscilla Walmsley.

(The "closed under union" attribute is a bit obscure. Maybe an example will
help explain it. Using RELAX NG, I was able to combine James Clark's schema
for XSLT 1.0 with my own schema for XSLT 2.0, using yet a third schema that
included them both as choices, and validate either kind of document with the
union of the schemas, based on the version number specified on the root
element.)

Bob

"Pieter" <pi****@west.nl> wrote in message
news:cf**************************@posting.google.c om...
I've read a lot of posts on "why relax ng is so very good" and on "why
w3c xml schema should be the only schema language". I'm, however,
still not clear on why I should prefer one over the other.

I've made a small list of some good and bad points of both. These
points don't really go into the grammar aspects of these languages,
but are more about secondary aspects. The grammar aspects are
different, but both are suitable for validating an XML document. Both
schema languages have good and bad points in them. Any comments on the
languages themselves will therefore (at least in my opinion) not help
to make a choice. However, points like support by tools and how widely
spread the use is (are they both widely used? I don't know this and
haven't been able to find much on it), do make a difference.
W3C XMl Schema
+ versatile: not only useful for validation, but also for
classification of elements and attributes, identifying their
semantics. It can send documentation and application information to
the processor.
+ it employs oop aspects
+ w3c recommendation
+ tools support
- complex
- documentation is hard to understand

Relax NG
+ especially the compact syntax is very clear and intuitive
+ was designed to be able to incorporate elements of other schema
languages (e.g. the data types of w3c schema), which makes it easy to
adapt the language to your needs
+ tool support is slowly expanding
+ draft standard of the Document Description and Processing Languages
subcommittee of the ISO/IEC Joint Technical Committee
- only suitable for validation
- documentation and application information are not supported
- xslt 2.0 is designed to use schemas. From the working draft it seems
that, although every schema language should be supported, w3c xml
schema will be more supported than other schema languages

I don't believe this list is exhaustive or even entirely correct.
However, I hope people on this list can help me make a choice. I
suppose it therefore is useful to explain what the XML Schema will be
used for.
I'm working on a program that generates an XML document which contains
a Java-like programming language. This document should be validated
and then, with the help of XSLT, translated into XMI, which can then,
for instance, be imported into rational rose in order to create class
diagrams.
I suppose that for the validation part both Relax NG and WXS could be
used. However, for the transformation part, they might not be equally
suited. Maybe this is not true, but I just do not know and hope people
on this list can help me.
Some demands for the choice of the schema are that is should be easy
to read and understand, easy to change and easy to maintain.

Jul 20 '05 #3
"Edwin Dankert" <ed******@cladonia.com> wrote in message
news:l1******************@news.indigo.ie...
[*] Conversion

It seems to be possible at the moment to convert (without loss?) from
RelaxNG to XML Schema however not the other way around.


Not without loss, because XML Schema can't describe all the grammars that
RELAX NG can. Much of the time, however, Trang will convert RELAX NG to the
nearest correct XML Schema, i.e., to one that will accept every document
that the original will accept, even if it accepts some documents the
original won't.

Bob Foster
Jul 20 '05 #4
"Bob Foster" <bo********@comcast.net> wrote in message news:<8A3xb.313833$Fm2.329327@attbi_s04>...
"Edwin Dankert" <ed******@cladonia.com> wrote in message
news:l1******************@news.indigo.ie...
[*] Conversion

It seems to be possible at the moment to convert (without loss?) from
RelaxNG to XML Schema however not the other way around.


Not without loss, because XML Schema can't describe all the grammars that
RELAX NG can. Much of the time, however, Trang will convert RELAX NG to the
nearest correct XML Schema, i.e., to one that will accept every document
that the original will accept, even if it accepts some documents the
original won't.

Bob Foster

That's true. Lossless conversion is not always possible.

Thanks for the points you have given me so far. They are very useful
to me. However, for the validation part I'm convinced both are equally
usefull.
But, more important, can they both be used for the transformation part
? That is, does XSLT 2.0 handles both schema languages equally well.
Related to this is off course if this is important at all. Is the
support for schemas in XSLT 2.0 in any way useful ?
Jul 20 '05 #5
> But, more important, can they both be used for the transformation part
? That is, does XSLT 2.0 handles both schema languages equally well.
Related to this is off course if this is important at all. Is the
support for schemas in XSLT 2.0 in any way useful ?


I am not a XSLT expert (not even a beginner) but I thought that XSLT 2.0 has
only support for 'XML Schema Datatypes'? (please correct me if I'm wrong)

The 'XML Schema Datatypes' (part 2) should not be confused with the 'XML
Schema Structures' (part 1). There seems to be a consensus at the moment
(even in the RelaxNG world) that the 'XML Schema Datatypes' specification is
not that bad.

You can even use 'XML Schema Datatypes' in RelaxNG and some other languages
(WSDL, SOAP, RDF), I don't see this as a reason to discard either RelaxNG or
XML Schema, however it might be a good idea (if there is a need to use
types) to define your data using 'XML Schema Datatypes'.

Regards,
Edwin Dankert
Cladonia Ltd.
http://www.cladonia.com/
Jul 20 '05 #6
For future reference I want to conclude this discussion with my choice
and the reasons I have for it.
First I'm going for W3C XML Schema (WXS). Well, now that is out there
I will state my reasons.

- with the coming of XSLT 2.0 (which support schemas and not just data
types !) I think WXS has a juge advantage. Even though XSLT 2 should
support other languages too, in a short email discussion Michael Kay
(the author of the document on XSLT 2 on w3.org) stated that XSLT 2
has only been tested with WXS and he did not know if other languages
will be tested too. Even though I do not know if I will need to
combine XSLT 2 and XML Schema (XSLT 2 can function without schemas), I
do not want to restrict myself.
- user and vendor support is much larger for WXS than for Relax.
Because other people will be using what I'm making, it is most likely
that they know WXS. It will therefore probably be easier for them to
understand and maintain a WXS schema than a Relax schema.
- I have no need for the better support of Relax for specifying the
root-element of a document, because the XML document will be
auto-generated, which gives me, as the programmer of both the schema
as the program that will generate the XML the power to make sure this
will never go wrong.
- I have no need for the better handling of attributes of Relax,
because attributes will not play an important role in my XML document.
- I need the constraints mechanism (i.e. minOccurs and maxOccurs) of
WXS. Relax has nothing like that.

These are the most important points for me to choose WXS.
I hope it helps others to make a well-motivated choice.
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Olivier Hoarau | last post by:
Hello, I have to validate a xml file, for that I use libxml and its function xmllint which needs the RELAX NG "full" schema of the file. I have only its RelaxNG compact schema, I have to...
0
by: Jari Kujansuu | last post by:
I am trying to learn to use jing through JARV interface and I have read JARV User's Guide (http://iso-relax.sourceforge.net/JARV/JARV.html). I have downloaded jingjarv-examples.zip from JARV...
0
by: Geert | last post by:
Hello, I'm trying to write a RELAX NG schema that *only* validates the following XML instance (with mixed content): <div id="1">A<a href="X"/></div> The problem is to constrain the text...
0
by: Henri Sivonen | last post by:
I have written a servlet wrapper and a custom entity resolver for Jing. My code needs to decide whether to instantiate a compact syntax schema reader or an XML syntax schema reader. I would very...
4
by: withtape | last post by:
Somebody please, please help me. I'm getting started using Relax NG to describe document schemas. After reading the grammar summarized by http://www.relaxng.org/spec-20011203.html (Section 5), I...
3
by: Lord0 | last post by:
I *think* I need to be able to validate subsets of an XML document using different schema. The functionality I'm trying to implement is this. a) External suppliers produce an XML document...
1
by: Torsten Munkelt | last post by:
Hi, I want to validate an XML document applying a combination of RELAX NG and Schematron. I have not found an appropriate validator. Would you please send me links to such validators. I would...
2
by: Andy Chambers | last post by:
Hi All, Is there a way to define an empty named pattern? Here's the use-case. I'm trying to use relax-ng to specify an extendable schema. Basically, people should be able to tack on whatever...
2
by: McSwell | last post by:
We have a small (~50 line) DTD and a slightly larger (~300 line) W3C schema that we need to convert to Relax NG. (And I have a larger W3C schema that I may some day convert.) I was hoping that...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.