.net - Choice between two XSD groups with same name -
I have a schema that needs to allow one or more of the two groups of elements: < / P>
& lt; Xs: element name = "parent" maxOccurs = "99" & gt; & Lt; XS: complexType & gt; & Lt; XS: Options & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "address" type = "x: string" /> & Lt; Xs: element name = "city" type = "x: string" /> & Lt; Xs: element name = "state" type = "x: string" /> & Lt; Xs: element name = "zip" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "address" type = "x: string" /> & Lt; Xs: element name = "state" type = "x: string" /> & Lt; Xs: element name = "zip" type = "x: string" /> & Lt; Xs: element name = "country" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: Options & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; But verification is always done on the first option (it says Missing Element City) How can I take it to work? I am using .NET XSD 1.0 and I can not change XML
This works
& Lt; / XS: sequence & gt; & Lt; / XS: Group & gt; & Lt; Xs: Group Name = "National Elements" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "city" type = "x: string" /> & Lt; Xs: element name = "state" type = "x: string" /> & Lt; Xs: element name = "zip" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: Group & gt; & Lt; Xs: Group Name = "International Elements" & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element name = "state" type = "x: string" /> & Lt; Xs: element name = "zip" type = "x: string" /> & Lt; Xs: element name = "country" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: Group & gt; & Lt; Xs: element name = "parent" maxOccurs = "99" & gt; & Lt; XS: complexType & gt; & Lt; XS: Sequence & gt; & Lt; Xs: group ref = "shared elements" /> & Lt; XS: Options & gt; & Lt; Xs: group ref = "national elements" /> & Lt; Xs: group ref = "international elements" /> & Lt; / XS: Options & gt; & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt;
Comments
Post a Comment