The fact that the translation of Relax NG schemas into W3C XML Schema was
considered impossible wasn't a good enough reason for James Clark, who presented
at XML 2002 the latest progress of Trang, his multi-format schema converter.
While it is not possible to transform any Relax NG schema into W3C XML
Schema, Clark considered that in most of the cases a converter smart enough
to figure out the intent of the author should be able to
write a readable W3C XML schema. This would be as good as a schema
written directly using W3C XML Schema, and a good approximation of the Relax NG
original schema. Clark's presentation showed that this goal is not far from
being met.
To achieve his aim, Clark had to make abstraction of the syntaxes beyond the
two schema languages and to define a data model which is intermediate between
Relax NG and W3C XML Schema. The translation is done in two steps: the Relax
NG schema is parsed and feeds the data model, and criteria
are applied to this data model to decide which W3C XML Schema should be used
to get the best results both in term of approximation and readability.
The results from the examples presented by Clark is outstanding, and he has
acknowledged that writing Trang was much more complex than writing a Relax NG
implementation.
There appears to be quite a demand behind this tool too, as many developers
are attracted by the simplicity of Relax NG, while they need to publish WXS
schemas to be used by an increasing number of tools (Office 11 for instance
requires WXS schemas). Clark's answer to this request is simple:
"don't bother with W3C XML Schema, write your schemas with Relax NG and use
Trang to convert them."
Other stories: