[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSD substitution groups, subtypes, nillable .. the whole smack
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|