W3C home > Mailing lists > Public > www-ws-desc@w3.org > January 2005

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

From: Arthur Ryman <ryman@ca.ibm.com>
Date: Thu, 27 Jan 2005 15:58:17 -0500
To: "Ugo Corda" <UCorda@SeeBeyond.com>
Cc: www-ws-desc@w3.org, www-ws-desc-request@w3.org
Message-ID: <OF8013BF04.8E56C296-ON85256F96.00717CA5-85256F96.00733324@ca.ibm.com>
Ugo,

Thx. Oxygen is giving the identical error message to Xerces. They are 
referencing an "official" Schema error.[1]

I think we can sefely regard this as disallowed by Schema. We don't have 
to check for equivalent definitions are let the later one override the 
earlier one, etc.

[1] http://www.w3.org/TR/xmlschema-1/#sch-props-correct

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/



"Ugo Corda" <UCorda@SeeBeyond.com> 
Sent by: www-ws-desc-request@w3.org
01/27/2005 03:32 PM

To
Arthur Ryman/Toronto/IBM@IBMCA, <www-ws-desc@w3.org>
cc

Subject
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/


picture
(image/gif attachment: 01-part)

Received on Thursday, 27 January 2005 20:59:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:58:34 GMT