- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Sun, 11 Aug 2002 16:05:33 +0100
- To: "Frank Langel" <frank.langel@webmethods.com>
- CC: xmlschema-dev@w3.org
Hi Frank, > i looked into the XML Schema specs, but i am not sure if a > validation rule such as > > - for instance : if field a==21 and b==32 and field x==field z then > c must be not null) > > can be expressed in XML Schema ? No, it can't. This is what's known as a co-occurrence constraint, where the values or presence of particular elements or attributes influence the value of another element or attribute (or whether it can be present). It's one of the areas where XML Schema is particularly weak. However, you can embed Schematron rules in your XML Schema to test this kind of thing. Schematron rules use XPath syntax, so your test might be something like: <sch:report test="(a = 21 and b = 32 and x = z) and not(string(c))"> a is 21, b is 32, x equals z, but c doesn't have a value. </sch:report> [Here assuming that "c must be not null" means "c must have a string value".] Have a look at Topologi's Schematron validator and Eddie's description of how to incorporate Schematron into XML Schema at http://www.topologi.com/public/Schtrn_XSD/Paper.html Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Sunday, 11 August 2002 11:05:39 UTC