IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: xsd_newbie
About
User Name: xsd_newbie
Forum Rank: Newbie
Real Name:
Location Pasadena, CA
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Monday, July 13, 2009
Last Visit: Wednesday, July 15, 2009 4:30:32 PM
Number of Posts: 2
[0.01% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: XSD Indicators or Compositors
Posted: Tuesday, July 14, 2009 6:54:33 PM
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?
Topic: XSD Indicators or Compositors
Posted: Monday, July 13, 2009 10:33:36 PM
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>

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.