[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: .NET schema validator issue

  • To: "Paul Hermans" <paul_hermans@p...>,<xml-dev@l...>
  • Subject: RE: .NET schema validator issue
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Mon, 2 Sep 2002 08:37:14 -0700
  • Thread-index: AcJSjvAYob80O13gT2iTFXooIKnUeQAB3Lqg
  • Thread-topic: .NET schema validator issue

.net schema
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@p...] 
	Sent: Mon 9/2/2002 7:38 AM 
	To: 'xml-dev@l...' 
	Cc: 
	Subject:  .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 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.