W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2002

Re: Question on use="required"

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 29 Aug 2002 19:04:45 +0100
Message-ID: <1571485290825.20020829190445@jenitennison.com>
To: xmlschema-dev@w3.org, "Stanley Guan" <stanley.guan@oracle.com>
CC: www-xml-schema-comments@w3.org

Hi Stanley,

> To conclude, there are only the following possibilities:
>   1. use="optional" default="1.0"
>       valid: <doc /> or
>                 <doc version="1.0" /> or
>                  <doc version="2.0"


>   2. use="prohibited" fixed="1.0"
>       valid: <doc />
>       invalid: <doc version="1.0" /> or
>                  <doc version="2.0"

Nope. use="prohibited" is only used when you're deriving a type by
restriction and you want to say "elements of this type cannot have
this attribute". When you derive a type by restriction, all the
attributes from the base type are inherited by the restricted type
*unless* you specify use="prohibited". If you try to specify a default
or fixed value on an xs:attribute with use="prohibited", it'll just
get ignored.

>   3. use="required" fixed="1.0"
>       valid:   <doc version="1.0" />
>       invalid: <doc version="2.0" /> or
>                   <doc />


>   4. use="optional" fixed="1.0"
>       valid: <doc version="1.0" /> or <doc />
>       invalid: <doc version="2.0" />


So in fact there are five combinations if you include ones without
value constraints:

  optional without default or fixed value
  optional with default value
  optional with fixed value
  required without default or fixed value
  required with fixed value



Jeni Tennison
Received on Thursday, 29 August 2002 14:04:52 UTC

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