RE: Changing "substitutionGroup" to "choice" and maintaining the validation equality of the schema

Thanks Harald,

I was quite happy with the `so far so good' part but I'm a bit confused
with your follow up...
(btw. please excuse if this turns out to be a "stupid question". I do
not really know all the tiny bits of XSD).

Here are the schemas that you've given:

>Schema 1: targetNamespace: ns1 
> element A (abstract=true) 
> element B (substitutionGroup="ns1:A") 
> element C (substitutionGroup="ns1:A") 
> element D () - sequence - element (ref="ns1:A") 

>Schema 2: targetNamespace: ns2 
> element E (substitutionGroup="ns1:A") 
> element F () - sequence - element (ref="ns1:A") 

>D translates into: 
> element D () - sequence - element - ref="ns1:B" 
>                                   - ref="ns1:C" 
>F translates into: 
> element F () - sequence - element - ref="ns1:B" 
>                                   - ref="ns1:C" 
>                                   - ref="ns2:E" 
>so far so good, but imagine the following instance: 
><ns1:root><ns1:D><ns2:F>... [ns2 is located by xsi:schemaLocation] 

Last row, gives an XML instance like this I guess:

<ns1:root>
  <ns1:D>
     <ns2:F>
      ...
     </ns2:F>
  <ns1:D>
</ns1:root>

If that is so, than I do not see why do you expect this to be a valid
document in respect to Schema 2.
If I'm not wrong, when you wrote Schema 2 you imported Schema 1, and
thus Schema 2 declares both 
ns2:F and ns1:D as shown below:

Both (ns2:F and ns1:D) - sequence - choice - ref="ns1:B" 
                                           - ref="ns1:C" 
                                           - ref="ns2:E" 

I do not see the schema declaration that allows ns2:F to be nested in
ns1:D like in the example?
What did I get wrong?

Thanks,
Marko.

************************* 
Research assistant, Database Technology 
Department of Computer Science, University of Twente 
P.O. Box 217, 7500 AE Enschede, The Netherlands 
Phone +31 (053) 489 4520, Fax ~ 2927 
E-mail: m.smiljanic@utwente.nl 
WWW: www.cs.utwente.nl/~markosm 

Received on Friday, 17 October 2003 09:19:46 UTC