- From: Gary Robertson <gazinyork@hotmail.com>
- Date: Thu, 8 Nov 2001 06:00:40 -0500 (EST)
- To: <xmlschema-dev@w3.org>
The whole key/keyref/unique identity constraint thing is complex and inflexible and some tools (e.g. XML Spy) still have bugs in their implementation of it and some (MSXML4 beta2) allow greater flexibility than legal in the xpath expressions. What I found was that I spent days trying to understand and get working the several aspects of a key/keyref relation: placement of each of the key and keyref tags and then formation of correct xpath expressions for each only to find out that the xpath expressions were a _very_ restricted subset (you can only "look down" using relative paths), the error messages given (by the parser I was using anyway) incomprehensible and may of the real world relationships that I wanted to describe were not possible. Also modularity is poor. For example: you often need to place the tags quite far away from what they refer to; it is not possible to define a complex type which contains an identity constraint that requires IDs of several child elements to be unique within each instance of the type. In short, by themselves, XML schema are not yet powerful enough to describe many (most?) real commercial world systems. I've migrated to using Schematron instead (thank you Jeni Tennison for saving me from more XML schema hell). It means that I've had to add an extra XSLT sylesheet processing stage to my parser but at least I get the full power of xpath and the ability to define your own error messages. I can also put in more complex constraints like "I want this attribute to be present or this attribute to be present but not both" or "I want this attribute to be a key but I want it to be optional" or "if element X is present then element Y must be present otherwise if must be absent". A warning though: it does take a while to get into the swing of the xpath expressions. For example, current() can mean different things depending on where you put it in the expression. An alternative would have been for me to embed all my relationship constraints into my program (in C++ in my case) but that would negate the whole idea of making our data model public, which is the main aim of the project. -- Gaz
Received on Friday, 9 November 2001 04:12:06 UTC