W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

Restricting the simpleContent of a complexType

From: <lispj@mail.ukoln.ac.uk>
Date: Wed, 15 May 2002 07:30:05 +0100 (BST)
To: xmlschema-dev@w3.org
Message-ID: <1021444205.3ce2006d4b73d@webmail.bath.ac.uk>
Cc: lispj@ukoln.ac.uk
Hello,

I'm trying to derive a new complexType by restricting the simpleContent of a 
base complexType. e.g. (assuming I have declaration and an import for the "x:" 
namespace)

  <xs:complexType name="baseType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute ref="x:lang" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="RFC1766">
   <xs:simpleContent>
    <xs:restriction base="baseType">
      <xs:simpleType>
          <xs:restriction base="xs:language"/>
        </xs:simpleType> 
        <xs:attribute ref="x:lang" use="prohibited"/>
    </xs:restriction>
   </xs:simpleContent>
  </xs:complexType>

It seemed to me this should be OK as xs:language is derived from xs:string. As 
far as I can see, this _seems_ to be acceptable to the XSV (latest release), 
Xerces Java 2 (latest release) and MSXML (probably not quite the most recent 
update), but XML Spy rejects it (complaining that xs:simpleType is unexpected 
at that location in the derived type definition). 

I'm inclined to go with the majority vote here, but I would welcome some 
reassurance that this is OK - or, indeed, a clear indication that it is broken!

Thanks very much

Pete Johnston
Received on Wednesday, 15 May 2002 12:26:33 UTC

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