abstract simple content

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 UTC