Wednesday, March 14, 2007

XML Schema or RELAX NG (RNG)

We all know that the following limitations in DTD pushed for a new schema standard.

  1. DTD is expressed in its own language. We need to master another set of notations to work with DTD.
  2. We have no way to specify data types and data formats.

To overcome these issues, XML Schema (W3C standard) and RELAX NG (OASIS standard) were introduced. Both of them are based on XML itself.

There’s been a schema war among industry experts for a quite some time. You won’t disagree with me that XML schema enjoys a wider acceptance in the current software market (at least in the areas I am working on). But, which one is better, XML Schema or RELAX NG? I being a novice in this area, went on to browse through old archives at IETF XML USE newsgroup.

James Clark's post to promote RELAX NG is quite lengthy but philosophical. The follow up post by Eric Sedlar’s (Oracle Corporation) to defend XML Schema also has some valid points.

I agree that RNG is easy to understand with this excellent tutorial. At the same time, I was able to grab the concept behind XML Schema (which I currently use) quite easily. On the surface, it seems to me that the major difference lies in the style: while XML Schema categorize patterns into distinct components such as elements, attributes, complex/simple types, etc., RNG introduces generic patterns. I need to dive deep into both schemas in order to provide an objective and practical comparison. Wait..what about Schematron? I like the fact that it (schematron) does not impose any ordering of sibling elements (in contrary to XML Schema and RNG), which is quite valid and sufficient for data centric applications.

No comments: