- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Tue, 4 Dec 2001 20:22:45 +0000
- To: Niko Suave <niko@alum.mit.edu>
- CC: xmlschema-dev@w3.org
Hi Niko, > I know that an extended type is always the same as the base + some > extra; so, how does that relate to attributes? Does this mean that > an extended type may not redefine an existing attribute of the base? Yes, that's right. > My gut says that extension2 is clearly invalid (clearly, it could be > implemented as an extension followed by a restriction). My > understanding of the rules (see below) would suggest that the > use="prohibited" clause actually removes the corresponding attribute > use from the list of the class, and therefore the attribute use list > for 'base' is not a subset of the attribute use list for extension2, > and so the extension is not valid. Yes, that's right. > If this is correct, then I would like to know how that relates to a > wildcard: what if you have a prohibited attribute that would > otherwise be allowed by a wildcard? Since it seems that Attribute > Uses do not include the option of something being explicitely > prohibited, that attribute would presumably be okay. I don't understand exactly what you mean here. Are you talking about something like: <xs:complexType name="base"> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="dead" type="xs:boolean"/> <xs:anyAttribute namespace="##other" /> </xs:complexType> <xs:complexType name="extension"> <xs:complexContent> <xs:extension base="base"> <xs:attribute name="xlink:href" type="xs:anyURI" use="prohibited" /> </xs:extension> </xs:complexContent> </xs:complexType> That isn't OK because you're trying to restrict what attributes are allowed on elements of the extension type. If you're talking about: <xs:complexType name="base"> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="dead" type="xs:boolean"/> <xs:attribute name="xlink:href" type="xs:anyURI" use="prohibited" /> </xs:complexType> <xs:complexType name="extension"> <xs:complexContent> <xs:extension base="base"> <xs:anyAttribute namespace="##other" /> </xs:extension> </xs:complexContent> </xs:complexType> Then I think that *is* OK because you're extending the permitted attributes. > I'm not sure about extension3, but the rules would seem to suggest > that it is okay since every attribute use in the base corresponds to > an attribute use in extension3 with the same name, target namesapce, > and type def but a different {Required} property. Is this correct? I don't think so. The fact that you *can* make an attribute required when you derive by restriction (see "Schema Component Constraint: Derivation Valid (Restriction, Complex)") is a good indication that you *can't* make an attribute required when you derive by extension :) But I agree that it's not all that clear in the Rec that this isn't allowed. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Tuesday, 4 December 2001 15:34:33 UTC