- From: Naren Chawla <naren_chawla@attbi.com>
- Date: Fri, 15 Mar 2002 08:16:53 -0800
- To: "Jeni Tennison" <jeni@jenitennison.com>, "Snow, Corey" <CSNOW@ddpwa.com>
- Cc: <xmlschema-dev@w3.org>
Jeni > - Express as much as you can in XML Schema, then use Schematron or another schema adjunct to express the co-occurrence constraint. > Is above a practical suggestion from a systems development perspective. Do you have a small example of how to achieve this ? I know there was discussion earlier about full support for "co-occurrence constraints" and we wanted to wind down further discussions. I thought I will squeeze in one small thought - From a practitioner's stand-point, I feel even if XML Schema is not "Turing complete", it should be "validation complete" (as Jeni suggested earlier). Though latter might lead to former. I would love to get rid on one more layer (validation layer) from my application. It appears to me "constraining the contents of XML instance" is a major goal behind XML Schema. Being able to achieve this successfully will lead us to exciting ways to develop applications broadly termed as "Schema-based programming". --Naren -----Original Message----- From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]On Behalf Of Jeni Tennison Sent: Friday, March 15, 2002 2:00 AM To: Snow, Corey Cc: 'xmlschema-dev@w3.org' Subject: Re: Attribute groups Hi Corey, > What I'd like to be able to do is make the attribute *group* > optional, based on whether one of the attributes in the group (the > required one) is supplied- in other words, if the attrOne attribute > is supplied, an attrTwo attribute may optionally be supplied. If > attrOne is not supplied, attrTwo CANNOT be supplied, but the > document remains valid if neither is supplied. What you're describing is a "co-occurrence constraint" in which the presence of one attribute affects whether the presence of another attribute is allowed. XML Schema is notoriously bad at co-occurrence constraints. The usual advice in this situation would be to do one of the following: - Express the distinct attribute combinations as separate complex types both derived from the same abstract complex type; make the element have the abstract type as its type; use the xsi:type attribute to identify which of the two types is being used in the particular instance. (Note that this involves changing the look of your XML instance documents.) - Express as much as you can in XML Schema, then use Schematron or another schema adjunct to express the co-occurrence constraint. If you want more details on either of these options, let us know. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Friday, 15 March 2002 11:16:19 UTC