XSD - how to generate enums starting from a different value than 0

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi All,
I have an XSD file , using the XSD tool generate the classes enums etc.
in my XSD there is a section for a specific enum

<pre><xs:simpleType name="VideoType
<xs:annotation>
<xs:documentation>The video type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string
<xs:enumeration value="RROI
</xs:enumeration>
<xs:enumeration value="DROI"/>
<xs:enumeration value="CROI"/>
</xs:restriction>
</xs:simpleType>[/code]

using the XSD produce the cs file:
<pre>/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://ElbitSystems/Skeye.Common.Infrastructure.Communication.SkeyeCommon.xsd")]
public enum VideoType {

/// <remarks/>
RROI,

/// <remarks/>
DROI,

/// <remarks/>
CROI,
}[/code]
what do i need to do if i want the generated class to start from 1 (or any other value) like:

<pre>/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://ElbitSystems/Skeye.Common.Infrastructure.Communication.SkeyeCommon.xsd")]
public enum VideoType {

/// <remarks/>
RROI =1,

/// <remarks/>
DROI =2,

/// <remarks/>
CROI =3,
}[/code]

Thanks in advance

E <hr class="sig Coder

View the full article
 
Back
Top