W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2012

Attribute with fixed value in derived types

From: Florent Georges <lists@fgeorges.org>
Date: Wed, 27 Jun 2012 10:44:49 +0100 (BST)
Message-ID: <1340790289.48058.YahooMailNeo@web29019.mail.ird.yahoo.com>
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
  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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:20 UTC