| xsd_newbie |
| Newbie |
|
| Pasadena, CA |
|
|
| None Specified |
|
| Monday, July 13, 2009 |
| Wednesday, July 15, 2009 4:30:32 PM |
2 [0.01% of all post / 0.00 posts per day] |
|
island wrote:Hi newbie,
try using a choice compositor instead of a sequence or all, and then setting the minOccurs to "0" and the maxOccurs to "unbounded" on this compositor. The elements within the choice can then appear or not appear in any order.
Thank you island,
I did try your suggestion, but it looks like <choice> is forcing an either/or situation. Once the first element is accepted, all others generate an error since the "choice" has been made. My understanding is that <choice> does not allow more than one of the child elements to be defined in the XML. Is that true?
Any other suggestions?
|
Hi everyone,
I'd like to know how I can modify an existing XSD so it can be more flexible. I have perhaps hundreds of complex elements which are defined with the <sequence> indicator, but the order in which the child elements are given really does not matter. I would like to permit any of the child elements written, but not require them in order (as with sequence indicator), nor require that they are ALL given (as with all indicator). Is there a way I can do this using XSD 2.20?
Bonus question:
I also have at least one complex type defined with <sequence> that contains a "nested" <choice>. If a change can be made to achieve my first goal, will this nested <choice> be affected?
EXAMPLE:
<xsd:complexType name="Sample"> <xsd:sequence> <xsd:element minOccurs="0" ref="name" /> <xsd:choice> <xsd:element ref="Person" /> <xsd:element ref="Organization" /> </xsd:choice> <xsd:element minOccurs="0" maxOccurs="unbounded" ref="Address" /> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" use="required" /> </xsd:complexType>
|
|