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

Re: Question on use="required"

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 14 Aug 2002 12:54:43 +0100
Message-ID: <37167120827.20020814125443@jenitennison.com>
To: xmlschema-dev@w3.org, Stefan Wachter <Stefan.Wachter@gmx.de>

Hi Stefan,

> I have a question regarding attribute declarations whose use
> attribute has the value "required". Must there be values for such
> attributes in instance documents or is it also allowed to have a
> fixed/default values filled in?

The instance document must specify a value for the attribute [1]. I
*think* that you're not allowed to specify a default value for a
required attribute in the schema, because default values only apply
when the attribute is missing, and if it's required it can't be
missing, but I can't find the constraint specifying that at the
moment. You can have fixed values for required attributes, however
(particularly useful for indicating the version of a markup language).

Cheers,

Jeni

[1] Clause 4 of http://www.w3.org/TR/xmlschema-1/#cvc-complex-type

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 14 August 2002 07:54:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT