Is there any way to make xsd2code ignore the order defined in XSD file and create classes which don't have order?

Mar 9, 2012 at 6:36 PM

XSD2Code cares for the sequence defined in xsd file and generates classes considering the order, e.g,

[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)]

 

I'm wondering if there is any way to generate classes which don't care for xsd orders, I mean order less classes.

Thank you,

Fatemeh

Mar 9, 2012 at 6:38 PM

test

Mar 15, 2012 at 3:48 PM
Edited Mar 15, 2012 at 3:49 PM

The line that causes that behavior is 
                const CodeGenerationOptions generationOptions = CodeGenerationOptions.GenerateOrder;

This is line 121 in Generator.cs in Xsd2Code.Library.

There aren't any options configured in Xsd2Code to change this behavior, so you would have to modify the source yourself.

You would change CodeGenerationOptions.GenerateOrder to CodeGenerationOptions.None.