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

Make an required attribute optional, by restriction?

From: Rainer Becker <r.becker@Nitro-Software.com>
Date: Wed, 17 Jul 2002 05:53:34 -0400 (EDT)
Message-ID: <819808E8E999D41196DA000102AF06CE0C63B8@SRV_KOM>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Hello all,
I do hope that this has not been covered before, but I have
got another derivation problem.
Given the following (simplified) schema:
<xsd:schema xmlns:xsd=" http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> ">
   <xsd:element name="Liste">
            <xsd:element name="Firma" type="FirmaType" />
   <xsd:complexType name="ListType">
         <xsd:element name="Name" type="xsd:string" />
      <xsd:attribute name="MId" type="xsd:integer" use="required" />
   <xsd:complexType name="FirmaType">
         <xsd:restriction base="ListType">
               <xsd:element name="Name" type="xsd:string" />
         <xsd:attribute name="MId" type="xsd:integer" use="optional" />

I was stunned seeing this schema being validated against an instance
without any mistake. 
My first question is: 
When deriving a type by restriction, I do not think
that it is a valid restriction for an attribute to an allow an
if the same attribute is required in the base type.
What am I missing here?
I must admit that it is very hard for me to read the Structures. It makes
it even harder, because Im not a native speaker. But enough of that.
I thought that the following exerpt 
Schema Component Constraint: Derivation Valid (Restriction, Complex) 
2.1 If there is an attribute use in the {attribute uses} 
    of the {base type definition} (call this B) whose 
    {attribute declaration} has the same {name} and 
    {target namespace}, then all of the following must be true:
2.1.1 one of the following must be true: B's {required} is false. R's {required} is true. 
would be an affirmation of my problem, I mentioned in the first question.
But regarding the facts Im facing, this cant be true.
My second question is:
What is this exerpt talking about, what am I expected to learn from it?
Because the heading says, "Schema Component Constraint", can this
exerpt be theoretical in some way?
Thank you
Rainer Becker
Received on Thursday, 18 July 2002 07:11:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC