Re: Question on use="required"

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"

Yep.

>   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 />

Yep.

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

Yep.

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

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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