[
Lists Home |
Date Index |
Thread Index
]
Thanks for pointing this out. This is a bug in our implementation which I filed upon confirmation.
-----Original Message-----
From: Paul Hermans [mailto:paul_hermans@protext.be]
Sent: Mon 9/2/2002 7:38 AM
To: 'xml-dev@lists.xml.org'
Cc:
Subject: [xml-dev] .NET schema validator issue
All schema validators we have (Xerces, Spy, Turbo XML, ...) do allow the following schema, except for Microsoft's .NET one.
The simplified example is:
<schema targetNamespace="urn:mpeg:mpeg7:schema:2001" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<simpleType name="termRelationQualifierType">
<union>
<simpleType>
<restriction base="NMTOKEN">
<enumeration value="NT"/>
<enumeration value="BT"/>
<enumeration value="RT"/>
<enumeration value="US"/>
<enumeration value="UF"/>
</restriction>
</simpleType>
<simpleType>
<restriction base="mpeg7:termReferenceType"/>
</simpleType>
</union>
</simpleType>
<simpleType name="termReferenceType">
<union>
<simpleType>
<restriction base="NMTOKEN">
<whiteSpace value="collapse"/>
<pattern value=":[^:]+:[^:]+"/>
</restriction>
</simpleType>
<simpleType>
<restriction base="anyURI"/>
</simpleType>
</union>
</simpleType>
<element name="test" type="mpeg7:termRelationQualifierType"/>
</schema>
xsdvalidate did return following error message.
D:\xmlschema\.NETvalidate>xsdvalidate -xsd union.xsd
ERROR: A union data type must be derived from an atomic or list data type. An er
ror occurred at file:///D:/xmlschema/.NETvalidate/union.xsd(3, 3).
Schema Validation Completed
Jeni Tennison was already so kind to explain me what the correct behavior is.
"if you're asking whether it's legal for
a member type of a union type to be a union type, then the answer is
yes, it's legal. In section 4.1.2.3 of the XML Schema Datatypes spec
it says:
"A ·union· datatype can be ·derived· from one or more ·atomic·,
·list· or other ·union· datatypes, known as the ·memberTypes· of that
·union· datatype."
I replied
"At 2.5.1.3 I read something differently
> "Any number (greater than 1) of atomic or list datatypes can participate in
> a union type."
No mention of unions."
Jeni developed this further
"I think that this is to do with the difference between whether
the simple type *component*'s {member type definitions} is allowed to
contain union types compared to whether you're allowed to refer to
union types when you define them with the XML syntax of XML Schema.
The {member type definitions} of the simple type must only contain
atomic and list data types, but you can refer to union data types when
you define the simple type in the XML syntax. If you do so, then the
member types of those union data types gets added to the {member type
definitions} for the simple type. {member type definitions} is defined
as:
The sequence of Simple Type Definition components resolved to by the
items in the actual value of the memberTypes [attribute], if any, in
order, followed by the Simple Type Definition components resolved to
by the <simpleType> [children], if any, in order. If {variety} is
union for any Simple Type Definition components resolved to above,
then the that Simple Type Definition is replaced by its {member type
definitions}."
My conclusion, as far as I understand, is:
.NET schema validation is wrong in this case
Any comments from Microsoft ?
Paul Hermans
Pro Text
Leuvensesteenweg 282c
3190 Boortmeerbeek
Belgium
+32 15 61 85 41
+32 15 62 03 99 (fax)
www.protext.be
|