[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSD substitution groups, subtypes, nillable .. the wholesmack

  • To: xml dev <xml-dev@l...>
  • Subject: XSD substitution groups, subtypes, nillable .. the wholesmack
  • From: Soren Kuula <dongfang@d...>
  • Date: Fri, 24 Feb 2006 17:51:00 +0000
  • User-agent: Mozilla Thunderbird (X11/20050322)

xsd substitution
Hi,

OK; here are the syntactically correct XSD definitions and declaratins, 
XSD namespace ignored, and target namespace is empty.

The notation of the translations just *are* ad hoc; they cannot be 
expressed in XSD directly, and I know no other schema language that 
supports substitution groups etc. that I could have expressed them in.

>
>> Hi, I'm trying to make a simpler structure for XML Schema -- by 
>> making implicit stuff explicit.
>>
<complexType name="a">
  <!--- some model --->
</complexType>

<complexType name="b">
  <extension base="a">
     <!--- some model -->
  </extension>
</complexType>

<complexType name="c">
  <extension base="b">
     <!--- some model -->
  </extension>
</complexType>

Assume that the types are OK; no UPA / EDC issues.

>> --- scenario 1 ---
>>
>> For a declaration:
>
>
<element name="x" type="a"/>

>> I take that to mean:
>>
>> There are three declaration of an element named x:
>>
>> There is a declared element with name x, type a, and an optional 
>> attribute xsi:type with values in {a} and an optional attribute 
>> xsi:nil with values in{false}
>>
>> There is a declared element with name x, with type b, and a required 
>> attribute xsi:type with values in {b} and an optional attribute 
>> xsi:nil with values in{false}
>>
>> There is a declared element with name x, with type c, and a required 
>> attribute xsi:type with values in{c} and an optional attribute 
>> xsi:nil with values in{false}
>>
>> Any big conceptual mistakes there? Hope not :)
>>
>> Now if I add
>
>
<element name="y" type="b"/>

>>
>> that will then be
>>
>> There exist two declaration of an element named y:
>>
>> One with type b, and an OPTIONAL attribute xsi:type with values in 
>> {b} and an optional attribute xsi:nil with values in {false}
>> One with type c, and a required attribute xsi:type with values in {c} 
>> and an optional attribute xsi:nil with values in {false}
>>
>> right?
>>
>> --- scenario 2 ---
>>
>> If I do
>>
<element name="x" type="a" substitutionGroup="y"/>

<element name="y" type="b"/>

>>
>> (with the same implications for implied declarations as above)
>>
>> can the (first) implied-declaration
>>
>> There exists a declared element named x with type a, and an optional 
>> attribute xsi:type with values in {a} and an optional attribute 
>> xsi:nil with values in {false}
>>
>> ever substitute an y element? As far as I understand no, but I'd be 
>> happy to have a confirmation.
>>
>> --- scenario 3 ---
>>
>> I take a declaration
>>
<element name="y" type = "b" nillable="false"/>

>> to mean
>>
>> There exists a declared element named y with type b, and an optional 
>> attribute xsi:type with values in {b} and an optional attribute 
>> xsi:nil with  values in {false}
>>
>> and
>
>
<element name="y" type="b" nillable="true"/>

>>
>> to mean
>>
>> There exists a declared element named y with type b, and an optional 
>> attribute xsi:type with values in {b}, and an optional attribute 
>> named xsi:nil with values in {false}
>>
>> There exists a declared element named y with type #EMPTY, and an 
>> optional attribute xsi:type with values in {b}, and a required 
>> attribute named xsi:nil with values in {true}
>>
>> i) How are the other implied declarations; are there 1 or 2 of them? 
>> One of these must be true:
>>
>> (R)
>> There exists a declared element named y with type c, and a required 
>> attribute xsi:type with values in {c}, and an optional attribute 
>> named xsi:nil with values in {false}
>>
>> OR
>>
>> (S)
>> (
>> There exists a declared element named y with type c, and a required 
>> attribute xsi:type with values in {c}, and an optional attribute 
>> named xsi:nil with values in {false}
>>
>> and
>>
>> There exists a declared element named y with type #EMPTY, and a 
>> required attribute xsi:type with value s in {c}, and an required 
>> attribute named xsi:nil with values in {true}
>> )
>>
>> Which one is it ? :)
>>
>> --- Scenario 4 ---
>>
>> if I have
>
>
<element name="x" type="b" nillable="true" substitutionGroup="y"/>

<element name="y" type="b" nillable="false"/>

>> is is true or false, or absurd to even talk about that elements of 
>> the implicit declaration
>>
>> There exists a declared element named x with type #EMPTY, and an 
>> optional attribute xsi:type with values in {b}, and a required 
>> attribute named xsi:nil with values in {true}
>>
>> can substitute elements declared by
>>
>> There exists a declared element named y with type b, and an optional 
>> attribute xsi:type with values in {b}, and an optional attribute 
>> named xsi:nil with values in {false}
>>
>> (I sure as XML Schema hope it's false)
>>
>> --- Scenario 5, final one ---
>>
>> if I have
>
>
<element name="x" type="b" nillable="true" substitutionGroup = "y"/>

<element name="y" type="b" nillable="true"/>

>>
>> is is true or false that elements of the implicit declaration
>>
>> There exists a declared element named x with type #EMPTY, and an 
>> optional attribute xsi:type with values in {b}, and a required 
>> attribute named xsi:nil with values in {true}
>>
>> can substitute elements declared by
>>
>> There exists a declared element named y with type #EMPTY, and an 
>> optional attribute xsi:type with value in {b}, and a required 
>> attribute named xsi:nil with values in {true}
>>
>> my bold guess is that it's true, but maybe....
>>
>>
>>
>> All right, I could go looking for the answers in the spec, but 
>> honestly, I don't have the courage for that; I'm still in R&R after 
>> my last encounter with it. My hope with this is that someone really 
>> knowledgeable about XML Schema can fill me / us in on it, and 
>> together we have then contributed a really simple way to tell how the 
>> whole subtyping / subst grp / nillable thing works.
>>
>> Soren
>
>
>
> Soren
>
Soren


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.