I need to develop XSD for the scenario where I have 2 element types Server 1 and Server 2 Server1 and Server2 There can be any number for, but at least one opportunity is mandatory either Server1 or Server2.
& lt; Element name = "server1" & gt; & Lt; ComplexType & gt; & Lt; Sequence & gt; & Lt; Element name = "hostName" type = "string" / & gt; & Lt; Element name = "portNumber" type = "integer" /> & Lt; Element name = "userName" type = "string" / & gt; & Lt; / Sequence & gt; & Lt; / ComplexType & gt; & Lt; / Element & gt; & Lt; Element name = "server2" & gt; & Lt; ComplexType & gt; & Lt; Sequence & gt; & Lt; Element name = "hostName" type = "string" / & gt; & Lt; Element name = "portNumber" type = "integer" /> & Lt; / Sequence & gt; & Lt; / ComplexType & gt; & Lt; / Element & gt;
Thanks
You Schema element with unlimited maxOccurs attribute
Sample:
& Lt; Element name = "userName" type = "string" / & gt; & Lt; / Sequence & gt; & Lt; / ComplexType & gt; & Lt; / Element & gt; & Lt; Element name = "server2" & gt; & Lt; ComplexType & gt; & Lt; Sequence & gt; & Lt; Element name = "hostName" type = "string" / & gt; & Lt; Element name = "portNumber" type = "integer" /> & Lt; / Sequence & gt; & Lt; / ComplexType & gt; & Lt; / Element & gt; & Lt; / Options & gt; & Lt; / ComplexType & gt; & Lt; / Element & gt; & Lt; / Schema & gt;
Comments
Post a Comment