XSD Make minOccurs depend on containing type -
I have a complex type defined that currently does not have any minOccurs restriction when I type an element of this complex type I sometimes use elements minOccurs 0, other times 1. for example.
& lt; Xsd: complex type name = "identifier" & gt; & Lt; XSD: Sequence & gt; & Lt; Xsd: element name = "id" type = "xsd: string" /> & Lt; Xsd: element name = "version" type = "xsd: string" /> & Lt; / XSD: Sequence & gt; & Lt; / XSD: complexType & gt; & Lt; Xsd: complex type name = "wrabs" & gt; & Lt; XSD: Sequence & gt; & Lt; Xsd: element name = "id" type = "identifier" /> & Lt ;! - I 'Wibble' - & gt; I want to be mandatory for all the identifiers used as part of & Lt; / XSD: Sequence & gt; & Lt; / XSD: complexType & gt; & Lt; Xsd: complex type name = "wobble" & gt; & Lt; XSD: Sequence & gt; & Lt; Xsd: element name = "id" type = "identifier" /> & Lt ;! - I 'wobble' - & gt; All elements of the identifier should be optional when used as part of. & Lt; / XSD: Sequence & gt; & Lt; / XSD: complexType & gt;
Is this possible?
Thanks in advance.
Groups are your friends, like
& Lt; / XSD: Sequence & gt; & Lt; / XSD: Groups & gt; & Lt; Xsd: complex type name = "wrabs" & gt; & Lt; XSD: Sequence & gt; & Lt; Xsd: group ref = "identifier group" minOccurs = "1" /> & Lt ;! - More elements for Wibble here - & gt; & Lt; / XSD: Sequence & gt; & Lt; / XSD: complexType & gt; & Lt; Xsd: complex type name = "wobble" & gt; & Lt; XSD: Sequence & gt; & Lt; Xsd: group ref = "identifier group" minOccurs = "0" /> & Lt ;! - More element for the wobble here - & gt; & Lt; / XSD: Sequence & gt; & Lt; / XSD: complexType & gt;
Comments
Post a Comment