Redefine and extension base

Hi,

I'm relatively new to XML Schema, so I may well be missing something
blindingly obvious, but I'd appreciate any help. One of the problems I've
encountered is the varying levels of support in different validating
parsers, but where there are variations, I've tended to place my faith in
XSV.

I think I've managed to strip my problem down to a simple example.

I have a schema which defines a complexType and an element based on that
complexType:

(File testdc.xsd)

<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns="http://purl.org/dc/elements/1.1/"
 targetNamespace="http://purl.org/dc/elements/1.1/"
 elementFormDefault="qualified"
 attributeFormDefault="qualified">

  <xs:complexType name="elementType">
   <xs:simpleContent>
    <xs:extension base="xs:string">
   <xs:attribute name="myatt1" type="xs:string"/>
     </xs:extension>
   </xs:simpleContent>
  </xs:complexType>

  <xs:element name="title" type="elementType"/>

</xs:schema>


I'm trying to redefine this in a second schema

(File new-testdc.xsd)

<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns="http://purl.org/dc/elements/1.1/"
 targetNamespace="http://purl.org/dc/elements/1.1/"
 elementFormDefault="qualified"
 attributeFormDefault="qualified">

  <xs:redefine schemaLocation="testdc.xsd">

  <xs:complexType name="elementType">
    <xs:simpleContent>
    <xs:extension base="elementType">
   <xs:attribute name="myatt2" type="xs:string"/>
     </xs:extension>
   </xs:simpleContent>
  </xs:complexType>

  </xs:redefine>

</xs:schema>

When I attempt to validate an instance against this, XSV (both the service
on the web and the Windows executable) reports an error in new-testdc.xsd
"Basing a type on itself is forbidden".

But under 4.2.2 of XML Schema 1: Structures, I find

> Type definitions must use themselves as their base type definition;

And in fact, if I change the base attribute value in new-testdc.xsd to, say,
xs:string, i.e.

<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns="http://purl.org/dc/elements/1.1/"
 targetNamespace="http://purl.org/dc/elements/1.1/"
 elementFormDefault="qualified"
 attributeFormDefault="qualified">

  <xs:redefine schemaLocation="testdc.xsd">

  <xs:complexType name="elementType">
    <xs:simpleContent>
    <xs:extension base="xs:string">
   <xs:attribute name="myatt2" type="xs:string"/>
     </xs:extension>
   </xs:simpleContent>
  </xs:complexType>

  </xs:redefine>

</xs:schema>

 then XSV tells me "attempt to redefine in terms of type other than self:
elementType vs. string" - which I guess is what I'd expect.

But it seems to want it both ways.... Is this a problem in XSV or (very
likely) have I missed something please?

Thanks

Pete Johnston
-------
Pete Johnston
Interoperability Research Officer
UKOLN, University of Bath, Bath BA2 7AY, UK
tel: +44 (0)1225 383619    fax: +44 (0)1225 386838
mailto:p.johnston@ukoln.ac.uk
http://www.ukoln.ac.uk/ukoln/staff/p.johnston/

Received on Friday, 11 January 2002 16:31:48 UTC