- From: Jesse McCarthy <mccarthy36@earthlink.net>
- Date: Wed, 19 Dec 2001 21:12:56 -0500
- To: xmlschema-dev@w3.org
Sorry if this has already been asked and answered, but the search function doesn't work blah blah blah, you know how that go. This is a question about schema structure. Can I redeclare an attribute when deriving a complexType? For example, if I want to create a generic type that specifies a minimal content model and one or more attributes and I want to derive other types from that, adding to the content model. and restricting the value of an attribute of the base type by setting a fixed or default value or restricting the value, etc. e.g. [code] .. <xsd:complexType name="BaseType"> <xsd:sequence> <xsd:element ref="JMM:someElementABC" /> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" /> </xsd:complexType> <xsd:complexType name="DerivedType"> <xsd:complexContent> <xsd:extension base="JMM:BaseType"> <xsd:sequence> <xsd:element ref="JMM:someElementXYZ" /> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" fixed="Derived" /> </xsd:extension> </xsd:complexContent> </xsd:complexType> .. [/code] The spec /seems/ to rule this out, but it would provide a useful facility for me, and the XSV schema validator linked from the W3C schema page doesn't seem to have a problem with it. Relevant parts of the spec: [ Complex Type Definition with simple content Schema Component {attribute uses} A union of sets of attribute uses as follows 1 The set of attribute uses corresponding to the <attribute> [children], if any. ... 3 if the type definition ·resolved· to by the ·actual value· of the base [attribute] is a complex type definition, the {attribute uses} of that type definition, ... ] [ 3.4.6 Constraints on Complex Type Definition Schema Components Schema Component Constraint: Complex Type Definition Properties Correct All of the following must be true: .. 4 Two distinct attribute declarations in the {attribute uses} must not have identical {name}s and {target namespace}s. ... ] What do you make of this? (please CC me when replying) --> Jesse
Received on Wednesday, 19 December 2001 21:21:48 UTC