Inconsistent sequencing [Order]

Mar 29, 2011 at 8:20 PM

When I use the Xsd2code, I have two properties (list of things) that generate an order attribute. minOccurs=0, maxOccurs=3

But the single complex types do not generate an order attribute. maxOccurs=1

That causes the following problem in my serialziation

If Order is used with any one property/field it has to be used with all the properties/fields. If not used with all the properties/field the compiler will throw a “System.InvalidOperationException” with the following Inner exception message.

“Inconsistent sequencing: if used on one of the class's members, the 'Order' property is required on all particle-like members, please explicitly set 'Order' using XmlElement, XmlAnyElement or XmlArray custom attribute on class member ‘XYZ’.”

When I add 

[System.Xml.Serialization.XmlElement(Order = 1)]

to the generated code, the serialization issue is resolved.

Is there an option I can set to always generate the 'Order' attribute?

 

 

 

Mar 30, 2011 at 1:59 PM

Same answer I gave on the other discussion, hope it helps:

You can generate Order attribute for simple types if you turn on GenerateXmlAttributes to true under Serialization.

Jan 3, 2014 at 2:50 AM
I tried that and then I get some weird ass exception about a "<schema xmlns='http://www.w3.org/2001/XMLSchema'> was not expected."}
Let face it xsd2code is plague with serious bugs all over the place
Coordinator
Jan 3, 2014 at 6:33 PM
Hello,
To generate always the order attribute you have to set GenerateXmlAttributes = true and GenerateOrderXmlAttributes = true.
stevensrf1, if you want more support, please post an xsd sample.
Pascal.