How to declare special XML schema (XSD) case?

For various reasons, none of Yuval's, Mo's or davidsheldon's samples work. Here's one that does xs:complexType name="myComplexType.

For various reasons, none of Yuval's, Mo's or davidsheldon's samples work. Here's one that does.

Alohci - I am curious to why my solution doesn't work. Could you please share your concerns about that? – Mo.

Jan 4 '09 at 12:17 I have marked my solution. Thank you for the clarification – Mo. Jan 4 '09 at 12:55.

EDIT: As Alohci mentioned, my solution is incorrect. According to the spec, an element in xs:all can only appear zero or one time. Sorry for any inconvenience I think what you want isn't a sequence.

A sequence defines not only the elements but also the order. And in your case the order may change. Have you tried xs:all?

Another appraoch might be to make it a sequence but mark the sequence to be maxOccurs="unbounded.

MaxOccurs="unbounded" is not allowed in a xs:all group. – Alohci Jan 4 '09 at 12:25.

It has been a while since I used schema, but I think sequences are your answer here. You need to have an unbounded number of choices between (an x), or (a y followed by an x).

This does not allow the group to be a single "y" element, but does allow y-x-y-x as valid sequence which shouldn't be allowed. – Alohci Jan 4 '09 at 12:34 Ah yes, I was trying to solve the wrong problem. – davidsheldon Jan 6 '09 at 11:34.

Not too complicated. Off the top of my head, it should be something like this: Since each element in XSD is optional by default, this XSD will match the XML structure you have defined, with the y element appearing anywhere before, after or between the x elements, with a maximum occurence of 1.

Thanks for your answer, however I think it more complex then this. I have the error of: cos-nonambig: x and x (or elements from their substitution group) violate "Unique Particle Attribution". (note that your suggestion is all under "xsd:sequence") Do you have other idea instead?

Thanks! – Ohad Jan 4 '09 at 9:38 Elements in XSD are not optional by default. Default is minOccurs="1".

Added minOccurs="0" to each gives the problem that Oger states in his comment. – Alohci Jan 4 '09 at 12:30 @Alohci - thanks for the clarification – Yuval Adam Jan 4 '09 at 20:54.

How to declare special XML schema (XSD) case - Stack Overflow.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions