- From: Anli Shundi <ashundi@tibco.com>
- Date: Wed, 14 Aug 2002 10:33:42 -0400
- To: "'Stefan Wachter'" <Stefan.Wachter@gmx.de>, Jeni Tennison <jeni@jenitennison.com>, xmlschema-dev@w3.org
If an attribute is required you cannot specify a value constraint [1] http://www.w3.org/TR/xmlschema-1/#src-attribute 1 default and fixed must not both be present. 2 If default and use are both present, use must have the ·actual value· optional Anli Shundi ashundi@tibco.com TIBCO Software Inc. office: (919) 969-6518 www.tibco.com -----Original Message----- From: Stefan Wachter [mailto:Stefan.Wachter@gmx.de] Sent: Wednesday, August 14, 2002 10:25 AM To: Jeni Tennison; xmlschema-dev@w3.org Subject: Re: Question on use="required" Hi Jeni, I agree with your answer that in the instance document there must appear a value for an attribute whose use is required. But I think it would be good to allow value constraints for such attributes in the schema for two reasons: 1. If I want to express that an attribute must be present and have a certain value. 2. There is a great schema which I import and which contains value constraints for various declarations. Some people (like me) do not like default values and want that an instance author must specify all values. Therefore I would restrict the imported declarations by adding the use="required" attribute. These declarations would now have value constraints and the use="required" attribute. --Stefan PS: So there is an error in the Microsoft testcase attribute/attP009.xsd. Theres is the complexType <xsd:complexType name="attRef"> <xsd:attribute name="att" use="required" fixed="37"/> </xsd:complexType> which is valid. But in the accompanying instance document attP009.xml there is no value for the attribute. > 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 10:40:08 UTC