Attribute with fixed value in derived types

  Hi,

  I have a complex type with a required attribute:

    <xs:complexType name="type">
       ...
       <xs:attribute ref="my:attr" use="required"/>
    </xs:complexType>

  I then use it to define some elements with additional children:

    <xs:element name="elem">
       <xs:complexType>
      <xs:complexContent>
         <xs:extension base="my:type">
        <xs:sequence>
           ...
        </xs:sequence>
         </xs:extension>
      </xs:complexContent>
       </xs:complexType>
    </xs:element>

  For some of those elements, I'd like to set a fixed value for the
attribute.  How can I do that, with XML Schema 1.0?  In addition, is
it possible to set a fixed value in the complex type, then to override
it in some elements only?

  Regards,


-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Received on Wednesday, 27 June 2012 09:45:26 UTC