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

XSD substitution groups, subtypes, nillable .. the whole smack

  • To: xml-dev@l...
  • Subject: XSD substitution groups, subtypes, nillable .. the whole smack
  • From: Soren Kuula <dongfang@d...>
  • Date: Fri, 24 Feb 2006 04:45:39 +0000
  • Newsgroups: comp.text.xml
  • User-agent: Mozilla Thunderbird (X11/20050322)

xsd optional attribute
Hi, I'm trying to make a simpler structure for XML Schema -- by making 
implicit stuff explicit.

If I have three types: a > b > c, meaning c is derived by extension from 
b, b is derived by extension from a

--- scenario 1 ---

For a declaration:

   element x of 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 value "a" and an optional attribute xsi:nil with 
value space {false}

There is a declared element with name x, with type b, and a requered 
attribute xsi:type with value "b" and an optional attribute xsi:nil with 
value space {false}

There is a declared element with name x, with type c, and a required 
attribute xsi:type with value "c" and an optional attribute xsi:nil with 
value space {false}


Any big conceptual mistakes there? Hope not :)

Now if I add

   element y of type b

that will then be

There exist two declaration of an element named y:

One with type b, and a requered attribute xsi:type with value "b" and an 
optional attribute xsi:nil="false"
One with type c, and a required attribute xsi:type with value "c" and an 
optional attribute xsi:nil="false"

right?

--- scenario 2 ---

If I do

   element x of type a subsitutionGroup="y"

   element y of 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 value "a" and an optional attribute xsi:nil="false"

ever substitute a y element? As far as I understand no, but I'd be happy 
to have a confirmation.

--- scenario 3 ---

I take a declaration

   element y of type b nillable="false"

to mean

There exists a declared element named y with type b, and an optional 
attribute xsi:type with values{b} and an optional attribute xsi:nil with 
   values{false}

and

   element y of type b nillable="true"

to mean

There exists a declared element named y with type b, and an optional 
attribute xsi:type with value space {b}, and an optional attribute named 
xsi:nil with value space {false}

There exists a declared element named y with type #EMPTY, and an 
optional attribute xsi:type with value space {b}, and a required 
attribute named xsi:nil with value space {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 value space {c}, and an optional attribute named 
xsi:nil with value space {false}

OR

(S)
(
There exists a declared element named y with type c, and a required 
attribute xsi:type with value space {c}, and an optional attribute named 
xsi:nil with value space {false}

and

There exists a declared element named y with type #EMPTY, and a required 
attribute xsi:type with value space {c}, and an required attribute named 
xsi:nil with value space {true}
)

Which one is it ? :)

--- Scenario 4 ---

if I have

   element x of type b nillable="true" substitutionGroup = "y"

   element y of 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 value space {b}, and a required 
attribute named xsi:nil with value space {true}

can substitute elements declared by

There exists a declared element named y with type b, and an optional 
attribute xsi:type with value space {b}, and an optional attribute named 
xsi:nil with value space {false}

(I sure as XML Schema hope it's false)

--- Scenario 5, final one ---

if I have

   element x of type b nillable="true" substitutionGroup = "y"

   element y of 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 value space {b}, and a required 
attribute named xsi:nil with value space {true}

can substitute elements declared by

There exists a declared element named y with type #EMPTY, and an 
optional attribute xsi:type with value space {b}, and a required 
attribute named xsi:nil with value space {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

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.