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 17:58:24 UTC