W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2000

anonymous types and extensions

From: <Mike_Leditschke@nemmco.com.au>
Date: Thu, 21 Dec 2000 11:25:55 +1000
To: xmlschema-dev@w3.org
Cc: jwollas@ue.com.au
Message-ID: <OF82C25DD5.07FD019C-ON4A2569BC.00066175@nemmco.com.au>
The examples I have seen using the derivation by extension
mechanism have all used an existing type as the base. Is it
possible to use an anonymous type in this situation?

For example, if I wish to have an element with simple content
consisting of a 10 character string and having a single checksum
attribute taking a value between 0 and 9, is the following legal?
(XMLSpy doesn't think so).

Schema

  <element name="Simple">
    <complexType>
      <simpleContent>
        <extension>
           <simpleType>
             <restriction base="string">
               <length value="10"/>
             </restriction>
           </simpleType>
           <attribute name="checksum" use="required">
             <simpleType>
               <restriction base="integer">
                 <minInclusive value="0"/>
                 <maxInclusive value="9"/>
               </restriction>
             </simpleType>
           </attribute>
        </extension>
      </simpleContent>
    </complexType>
  </element>


Example

<Simple checksum="5">abcdefghij</Simple>


I'm basically trying to avoid having to define a type for the simple
content of the element.

Thanks
Michael
Received on Wednesday, 20 December 2000 20:31:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT