I have a schema that has been in existence over 1 year. I have been making a few minor modifications to it recently and suddenly
the generated C# classes have made a radical change.
I have just compared the xsd source to the last compiled version on 8/25/06 and they are identical, yet the generated C# is
different. I do not know enough about XSD and schemas to understand how the original output was generated, but I need to get it
back.
I am showing an excerpt from the schema and the old and new generated C# class.
<xs:complexTy pe name="ListenerI tem">
<xs:sequence>
<xs:choice id="HostFormat" >
<xs:element name="HostName" type="mstns:Ful lyQualifiedName Type" />
<xs:element name="HostAddre ss" type="mstns:IPA ddressTypeV4" />
<xs:element name="Any" type="xs:string " />
</xs:choice>
<xs:element ref="mstns:Clie ntType" />
<xs:element name="HostPort" type="mstns:Por tNumberType" />
<xs:element name="NumThread s" type="xs:unsign edInt" />
<xs:element name="InitialSt ate" type="mstns:Lis tenerState" />
<xs:element name="Name" type="xs:string " nillable="false "></xs:element>
<xs:element name="AllowGene ricStation" type="xs:boolea n" nillable="false " default="false" ></xs:element>
<xs:element name="AllowClie ntSuppliedStati on" type="xs:boolea n" nillable="false " default="false" />
<xs:element name="AllowHost Lookup" type="xs:boolea n" nillable="false " default="false" />
<xs:element name="ClientVer sion" type="mstns:Cli entVersion" />
<xs:element name="Encryptio nRequirements" type="mstns:Enc ryptionEnum" />
<xs:element name="Authenica tionRequirement sRequired" type="mstns:Aut henicationEnum" />
<xs:element name="Authenica tionRequirement sAllowed" type="mstns:Aut henicationEnum" />
<xs:element name="KeepAlive Interval" type="xs:unsign edInt" default="5" />
<xs:element name="KeepAlive Units" type="KeepAlive UnitsType" default="Minute s" />
</xs:sequence>
</xs:complexType>
OLD C# Code
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "HostAddres s", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "Any", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "HostName", typeof(string))]
[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("ItemE lementName")]
public string Item;
/// <remarks/>
[System.Xml.Seri alization.XmlIg noreAttribute()]
public AddressTypeChoi ceWithAny ItemElementName ; <------------ see this line below
/// <remarks/>
public ClientType ClientType;
.......
NEW C# Code
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://tempuri.org/XMLSchema.xsd")]
public class ListenerItem {
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( "HostAddres s", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "Any", typeof(string))]
[System.Xml.Seri alization.XmlEl ementAttribute( "HostName", typeof(string))]
[System.Xml.Seri alization.XmlCh oiceIdentifierA ttribute("ItemE lementName")]
public string Item;
/// <remarks/>
[System.Xml.Seri alization.XmlIg noreAttribute()]
public ItemChoiceType1 ItemElementName ; <-------------- See type changed
/// <remarks/>
public ClientType ClientType;
.......
I would expect that most of you would say that I am crazy or that I have not been generating from the xsd that I though that I
had, but I have gone back in VSS for over the past year and that part of the schema has not changed and the generated C# has not
changed until today.
Could someone please tell me what to put into the schema to turn ItemChoiceType1 back to AddressTypeChoi ceWithAny?
Thanks
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com