- From: Michael Burns <Michael.Burns@sas.com>
- Date: Mon, 27 Nov 2000 17:07:32 -0500
- To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
- Message-ID: <764CA2FF49EC054BA086FC8253A52DD7624DEF@merc09.us.sas.com>
I have a problem with a schema I am developing where elements of a subtype
are not substitutable for elements of a supertype.
Am I doing something wrong or am I expecting XMLSchema to do something
that it is not designed to do?
I have a silly example to illustrate my point:
http://www.realtime.net/~mburns/xml/critters/Hawk1.xml <http://www.realtime.net/~mburns/xml/critters/Hawk1.xml>
This file reproduces a problem I am having with an XML Schema.
It's a rather silly example constructed by taking a sensible but
proprietary schema, simplifying it extensively and changing the
names of types to examples from the animal world. Hey, I have to
use my BS in Biology for something!
The type hierarchy looks like this:
Animal
Vertebrate
Bird
BirdOfPrey
Hawk
Mammal
Rodent
I have defined a bi-directional association between Vertebrate
and Vertebrate that defines the Preditor/Prey relationship.
This gets manifest in the model as a sub-element called
either FoodList or PredatorList that is a list of Vertebrate
elements.
In xml files where I reference the other member of the association
as Vertebrate then it works fine. But when I use a subtype of
Vertebrate I get validation errors like this:
file:/C:/ModelCompilerTestPen/test/Mouse2.xml:25:4: Invalid per cvc-complex-type.1.2.4: element {None}:BirdOfPrey not allowed here in element {None}:PredatorList:
file:/C:/ModelCompilerTestPen/test/Mouse2.xml:25:4: Invalid per src-resolve: undeclared element {None}:BirdOfPrey
It contains the following files:
-rw-r--r-- 1 544 everyone 4941 Nov 27 15:13 Critters.xsd
-rw-r--r-- 1 544 everyone 964 Nov 27 15:33 Hawk1.xml
-rw-r--r-- 1 544 everyone 974 Nov 27 15:21 Hawk2.xml
-rw-r--r-- 1 544 everyone 381 Nov 27 15:15 Hawk3.xml
-rw-r--r-- 1 544 everyone 369 Nov 27 15:24 Hawk4.xml
-rw-r--r-- 1 544 everyone 1010 Nov 27 15:38 Mouse1.xml
-rw-r--r-- 1 544 everyone 1042 Nov 27 15:37 Mouse2.xml
-rw-r--r-- 1 544 everyone 449 Nov 27 15:29 Mouse3.xml
Mouse3.xml, Hawk3.xml, and Hawk4.xml all validate cleanly with XSV.
However, Mouse1 and 2 don't and neither do Hawk1 and 2.
You can find all of these examples on my personal web page:
http://www.realtime.net/~mburns/xml/critters/ <http://www.realtime.net/~mburns/xml/critters/>
--------------------------------------------------------------------------------------------
Michael Burns email: Michael.Burns@sas.com
Principal Systems Developer home: mburns@bga.com
Metadata Integration Technology voice: (512)258-5171x3264
SAS Institute, Inc. fax: (512)258-3906
11920 Wilson Parke Ave. www: http://www.realtime.net/~mburns
Austin, TX 78726-4052 sww: http://sww.sas.com/~sasmkb
"choose for yourselves today whom you will serve;...
but as for me and my house, we will serve the Lord." Joshua 24:15
Received on Monday, 27 November 2000 17:22:25 UTC