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

Re: none

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 27 Jun 2001 11:52:28 +0100
To: bjornh@nada.kth.se
Cc: xmlschema-dev@w3.org, fredrik.fallstrom@mwm.se
Message-ID: <f5b4rt2dwk3.fsf@cogsci.ed.ac.uk>
bjornh@nada.kth.se writes:

> The question was about deriving from anySimpleType which, as far as I
> can understand, doesn't work correctly in XSV. I have made an example to
> illustrate:
> 
> The schema, test.xsd
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         xmlns:test="http://www.demo.com/test"
>         targetNamespace="http://www.demo.com/test">
> 
>   <element name="test">
>     <complexType>
>       <sequence>
>         <element ref="test:abstract_element" minOccurs="1"
> maxOccurs="unbounded" />
>       </sequence>
>     </complexType>
>   </element>
> 
>   <element name="abstract_element" type="anySimpleType" abstract="true"
> />
> 
>   <element name="test1" type="integer"
> substitutionGroup="test:abstract_element" />
>   <element name="test2" type="test:FooBar"
> substitutionGroup="test:abstract_element" />
>   <element name="test3" type="test:Integer"
> substitutionGroup="test:abstract_element" />
> 
>   <simpleType name="Integer">
>     <restriction base="anySimpleType">
>       <simpleType>
>         <union memberTypes="integer"/>
>       </simpleType>
>     </restriction>
>   </simpleType>

This is somewhere between misleading and not allowed.

Just use

  <simpleType name="Integer">
   <union memberTypes="integer"/>
  </simpleType>

> 
>   <simpleType name="FooBar">
>     <restriction base="string">
>       <enumeration value="foo" />
>       <enumeration value="bar" />
>     </restriction>
>   </simpleType>
> </schema>
> 
> 
> 
> The instance document, example.xml
> 
> <?xml version="1.0"?>
> <test xmlns="http://www.demo.com/test"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xsi:schemaLocation="http://www.demo.com/test
>                           http://datan.gt.kth.se/test/test.xsd">
> 
>   <test1>4711</test1>
>   <test2>foo</test2>
>   <test3>4711</test3>
> </test>
> 
> And the output from validating the instance document with XSV (when
> validating
> the schema itself there are no error messages).
> 
> Schema representation errors
> Detected during instance validation
> http://datan.gt.kth.se/test/test.xsd:16:89: Invalid: type {
> http://www.demo.com/test}FooBar not subtype of type {
> http://www.w3.org/2001/XMLSchema}anySimpleType of exemplar {
> http://www.demo.com/test}:abstract_element

That's an XSV bug.

> http://datan.gt.kth.se/test/test.xsd:14:75: Invalid: type {
> http://www.w3.org/2001/XMLSchema}integer not subtype of type {
> http://www.w3.org/2001/XMLSchema}anySimpleType of exemplar {
> http://www.demo.com/test}:abstract_element

That's the same bug.

> If I understand everything correctly this is exactly the opposite of the
> way it
> is supposed to work:-)
> 
> <test1> is an defined as an integer, which is derived from
> anySimpleType, and
> should work but doesn't (line 14)

bug.

> <test2> is derived from a string, which in turn is derived from
> anySimpleType,

bug.

> and should also work, but doesn't (line 16). I assume that derivation is
> transitive, so if A is derived from B and B is derived from C, then A is
> derived from C. Is that correct?

Yes.

> <test3> shouldn't work since it isn't allowed to directly derive user
> defined
> types from anySimpleType, but this one works fine.

What XSV prohibits is deriving anything by restriction _with facets_
from anySimpleType.  That's the spirit, but not the letter, of the
REC.  I'll ask for clarification.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Wednesday, 27 June 2001 06:52:25 GMT

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