[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSD substitution groups, subtypes, nillable .. the wholesmack
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! 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
|