- From: Gary Robertson <gazinyork@hotmail.com>
- Date: Fri, 9 Nov 2001 09:08:37 -0500 (EST)
- To: "Jeni Tennison" <jeni@jenitennison.com>
- Cc: <xmlschema-dev@w3.org>
----- Original Message ----- From: "Jeni Tennison" <jeni@jenitennison.com> To: "Gary Robertson" <gazinyork@hotmail.com> Cc: <xmlschema-dev@w3.org> Sent: Friday, November 09, 2001 10:56 AM Subject: Re: keyrefs > Hi Gary, > > > I've migrated to using Schematron instead (thank you Jeni > > Tennison for saving me from more XML schema hell). > > Oh that's right - name and shame ;) Credit where credit's due o<;-)> > > 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". > > Trying to redeem myself, I think you can probably do the latter two in > XML Schema. > If you want an attribute holding an key value to be optional, you can > use a unique identity constraint rather than a key identity > constraint. The unique identity constraint works in exactly the same > way as the key identity constraint (you can still refer to it with a > keyref) except that it doesn't force there to be a value of every > selected element in the schema. That's a handy hint: I'm annoyed with myself that I didn't try that one. > The fact that element X and Y go together is (I think) a matter of > writing the desired content model, which should be something that XML > Schema is good at. Yes it's good for the gross structural stuff when this can be fitted into parent and child(ren) hierarchies. I moved forward very quickly on this part of the project. I've also found it very good so far at specifying simple data types. It was mostly when I needed to start describing relationships that cut across hierarchies that things began to go wrong. I have many data elements that are referenced from several other places in many to one and many to many relationships. The trouble, as I'm sure you know, is that real-world systems are arbitrarily complex and often do not readily fit solely into any particular pattern (such as hierarchies or relational databases). The system I am trying to model is a case in point: although the data is stored in a relational database many additional relationships and business rules are present/enforced in the C++ code above the database layer. Also, from the users' point of view, parts of the data are hierarchical and parts are directed graphs (if that's the correct term for webs of symbols connected by arrows). The same data entities are often present in both and there are fairly complex (if you don't understand the application domain) rules about what can go where in both parts. I think that allowing full xpath syntax in refs/uniques/keyrefs (and adding user-definable error messages to them) would go a long way toward allowing me to do the things I need. Whether this would make XML schema a universal data description language (presumably the ultimate goal) or even satisfy all the requirements of this project, I don't know. > Actually RELAX NG is pretty good at the co-occurrence stuff - this > attribute or another attribute, this attribute or this element, 3 > occurrences of this element but mixed in any order. Schematron really > comes into its own, I think, when it's comparing values. I'm finding Schematron sufficient up to now but I'm doing this in the evenings as I've been taken off the data modelling part of the project for the meanwhile because my progress was so slow. I'll let you know if I come across anything that I need that Schematron _can't_ do. Thanks again for your help. I hope you're not experiencing any political troubles as a result. > Cheers, > > Jeni > > --- > Jeni Tennison > http://www.jenitennison.com/ > >
Received on Friday, 9 November 2001 10:34:27 UTC