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

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

From: Sanjiva Weerawarana <sanjiva@watson.ibm.com>
Date: Fri, 28 Jan 2005 07:04:09 +0600
Message-ID: <04ae01c504d5$485544a0$10dc3109@LANKABOOK>
To: "Ugo Corda" <UCorda@SeeBeyond.com>, "Arthur Ryman" <ryman@ca.ibm.com>, <ht@w3.org>
Cc: <www-ws-desc@w3.org>, <www-ws-desc-request@w3.org>
MessageWhy don't we ask Henry? I'm sure he'll explain it or fix it.

Henry?

Sanjiva.
  ----- Original Message ----- 
  From: Ugo Corda 
  To: Arthur Ryman 
  Cc: www-ws-desc@w3.org ; www-ws-desc-request@w3.org 
  Sent: Friday, January 28, 2005 3:09 AM
  Subject: RE: What Happens if 2 Inline Schemas Define the Same Element?


  Arthur,
  I would be inclined to reach the same conclusion, but I am usually careful before discounting XSV's opinion (since it is being developed by one of the "fathers" of XML Schema).

  Ugo
    -----Original Message-----
    From: Arthur Ryman [mailto:ryman@ca.ibm.com] 
    Sent: Thursday, January 27, 2005 12:58 PM
    To: Ugo Corda
    Cc: www-ws-desc@w3.org; www-ws-desc-request@w3.org
    Subject: RE: What Happens if 2 Inline Schemas Define the Same Element?



    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/ 




ATT3350112.gif
(image/gif attachment: ATT3350112.gif)

Received on Friday, 28 January 2005 01:04:59 GMT

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