W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

Re: How to Provide default elements in XMLSchema differentiated with attribute values

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 24 Jan 2002 10:58:09 +0000
Message-ID: <167330345101.20020124105809@jenitennison.com>
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:


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.



Jeni Tennison
Received on Thursday, 24 January 2002 05:58:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:55 UTC