- From: Rainer Becker <r.becker@Nitro-Software.com>
- Date: Wed, 17 Jul 2002 05:53:34 -0400 (EDT)
- To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
- Message-ID: <819808E8E999D41196DA000102AF06CE0C63B8@SRV_KOM>
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:complexType> <xsd:sequence> <xsd:element name="Firma" type="FirmaType" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="ListType"> <xsd:sequence> <xsd:element name="Name" type="xsd:string" /> </xsd:sequence> <xsd:attribute name="MId" type="xsd:integer" use="required" /> </xsd:complexType> <xsd:complexType name="FirmaType"> <xsd:complexContent> <xsd:restriction base="ListType"> <xsd:sequence> <xsd:element name="Name" type="xsd:string" /> </xsd:sequence> <xsd:attribute name="MId" type="xsd:integer" use="optional" /> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema> 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 use="optional", 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 I´m 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: 2.1.1.1 B's {required} is false. 2.1.1.2 R's {required} is true. would be an affirmation of my problem, I mentioned in the first question. But regarding the facts I´m facing, this can´t 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 Regards Rainer Becker
Received on Thursday, 18 July 2002 07:11:27 UTC