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

abstract simple content

From: GUSTIN Jean-Marc <jean-marc.gustin@swift.com>
Date: Mon, 14 May 2001 10:46:53 +0200
To: xmlschema-dev@w3.org
Message-id: <3AFF9B7D.C65BD336@swift.com>
I try to express the following.

I have a simple type "AccountNumber" which is a restriction on string.
I have 2 concrete types IBAN and BBAN that are based on AccountNumber.
It should not be possible to use "AccountNumber" but the derived types are valid.
As it is not possible to have abstract simple types I created a complex type with a simple content.
My schema is as follows:

<xs:schema xmlns:xs = "http://www.w3.org/2000/10/XMLSchema"
  elementFormDefault = "qualified">
 <xs:element name = "M" type = "M"/>
 <xs:complexType name = "M">
  <xs:sequence>
   <xs:element name = "AccountNumber" type = "AccountNumber"/>
  </xs:sequence>
 </xs:complexType>
 <xs:complexType name = "AccountNumber" abstract = "true">
  <xs:simpleContent>
   <xs:restriction base = "xs:string"/>
  </xs:simpleContent>
 </xs:complexType>
 <xs:complexType name = "IBAN">
  <xs:simpleContent>
   <xs:restriction base = "AccountNumber"/>
  </xs:simpleContent>
 </xs:complexType>
 <xs:complexType name = "BBAN">
  <xs:simpleContent>
   <xs:restriction base = "AccountNumber"/>
  </xs:simpleContent>
 </xs:complexType>
</xs:schema>

My validator accepts the schema mut don't validate the following instance:

<M xmlns:xsi = "http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation =
"file:///D:/SWS21/xml/accountnumber.xsd">
 <AccountNumber xsi:type="IBAN">value</AccountNumber>
</M>

Do you consider my schema and instance as correct?

Thanks,

Jean-Marc Gustin
Received on Monday, 14 May 2001 04:50:20 GMT

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