RELAX NG by Eric van der Vlist will be published by O'Reilly & Associates (ISBN: 0596004214)

You are welcome to use our annotation system to give your feedback.


Some ideas to make disambiguation easier

To close this chapter I'd like to present some ideas which would ease the challenge of disambiguating schemas.

In the different forms of ambiguity, name classes have been the easiest ones to disambiguate. Why is this? Name classes are not inherently simpler than regular expressions or datatypes. All of these tools are about defining sets of things that can happen in a XML documents and in many ways they are deeply similar. The reason that name classes have been easier to disambiguate is because they have a first class except operator. If we had the same level of support for patterns and datatypes, we could more easily disambiguate them.

If we could apply the except pattern to datatypes, it would be possible to disambiguate our example:

 element foo{xsd:boolean|xsd:integer}

is to write:

 element foo{ (xsd:boolean - xsd:integer) |xsd:integer}

A value which is only integer will obviously match only the right alternative. A value which is exclusively boolean ( true or false) will match the left alternative. A value which is both a boolean and an integer (0 or 1) will match the first condition of the left alternative ( xsd:boolean) but will not match the exception clause.

Unfortunately, this can't be generalized beyond the scope of data patterns (note that the examples given below with the except ( -) operator are not valid RELAX NG).

If this could be generalized, and applied to an ambiguous regular expression such as:

 two|(one?,two+,three*)

We would be able to write:

 two|((one?,two+,three*)-two)

Of course, this same set of results can be created with the existing RELAX NG patterns, but a generalized except would make that flexibility much more accessible.


You are welcome to use our annotation system to give your feedback.
[Annotations for this page]
All text is copyright Eric van der Vlist, Dyomedea. During development, I give permission for non-commercial copying for educational and review purposes. After publication, all text will be released under the Free Software Foundation GFDL.