RE: What Happens if 2 Inline Schemas Define the Same Element?

I did the same experiment, using an instance of the foo element to be
validated against foo.xsd. I tried 4 different schema validators. The
result are very similar except in one case: XSV. Here is a summary.
(Results were the same using the first version of foo-string.xsd with a
string, and the second version with an integer).
 
XSV 28-1
Warning: attempt to overwrite element {http://www.ibm.com/foo}foo,
ignored

XMLSpy 2005
Error: element 'foo' is already declared

Stylus Studio 6.0
Error: Global element'foo' declared more than once

Oxygen 5.1
[Schema 1, sec 3.15.6] Error: sch-props-correct.2: A schema cannot
contain two global components with the same name; this schema contains
two occurrences of 'http://www.ibm.com/foo,foo'

There are two interesting results to point out:
 
- XSV only generates a warning and validates with no errors (by ignoring
the second definition)
 
- Oxygen gives a specific reference to Schema to justify its error
message
 
Ugo
 
-----Original Message-----
From: www-ws-desc-request@w3.org [mailto:www-ws-desc-request@w3.org] On
Behalf Of Arthur Ryman
Sent: Thursday, January 27, 2005 9:58 AM
To: www-ws-desc@w3.org
Subject: What Happens if 2 Inline Schemas Define the Same Element? 




	We discussed this in the telecon today. I ran a little
experiment. Consider the master file: 
	
	<?xml version="1.0" encoding="UTF-8"?> 
	<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibm.com/foo"
xmlns:tns="http://www.ibm.com/foo"> 
	        <include schemaLocation="foo-int.xsd"></include> 
	        <include schemaLocation="foo-string.xsd"></include> 
	</schema> 
	
	Where foo-int.xsd is: 
	
	<?xml version="1.0" encoding="UTF-8"?> 
	<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibm.com/foo"
xmlns:tns="http://www.ibm.com/foo"> 
	        <element name="foo" type="int"></element> 
	</schema> 
	
	and foo-string.xsd is: 
	
	<?xml version="1.0" encoding="UTF-8"?> 
	<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibm.com/foo"
xmlns:tns="http://www.ibm.com/foo"> 
	        <element name="foo" type="string"></element> 
	</schema> 
	
	I validated the master document and got an error: 
	  
	
	I then changed the definition of foo-string so that it was
identical to foo-int and got the same error message. 
	
	The moral of the story is that the XML schema validator just
looked at the QName and when that was duplicated it raised an error,
even of the defintions were identical. 
	
	Arthur Ryman,
	Rational Desktop Tools Development
	
	phone: +1-905-413-3077, TL 969-3077
	assistant: +1-905-413-2411, TL 969-2411
	fax: +1-905-413-4920, TL 969-4920
	mobile: +1-416-939-5063, text: 4169395063@fido.ca
	intranet: http://labweb.torolab.ibm.com/DRY6/

Received on Thursday, 27 January 2005 20:32:47 UTC