- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Thu, 24 Jan 2002 10:58:09 +0000
- To: Rajan Gupta <rgupta99_1999@yahoo.com>
- CC: xmlschema-dev@w3.org
Hi Rajan, > I can write an XMLSchema for Liquids, but how do I enforce that > elements with water & milk as attribute values are present every > time an instanc document is created of the schema. I'm afraid that you can't in XML Schema. If your instance document used 'water' and 'milk' as the *names* of the elements: <FoodItems> <water><qty>100</qty></water> <milk><qty>50</qty></milk> <coke><qty>10</qty></coke> </FoodItems> Then you could represent the constraint in XML Schema. However, to get the kind of constraint you want, you need to state that a content model holds elements that share the same name but are of different types, and that's explicitly disallowed in XML Schema. You are better off using RELAX NG or Schematron to articulate this kind of constraint. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Thursday, 24 January 2002 05:58:10 UTC