이 버그입니까?Xsd.exe가 열거 형을 상속 할 때 잘못된 C# 클래스를 생성합니다.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="sbrSexItemType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="1"/>
<xsd:enumeration value="2"/>
<xsd:enumeration value="3"/>
<xsd:enumeration value="0"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="TestSexItemType1" type="sbrSexItemType"/>
<xsd:element name="TestSexItemType2" type="sbrSexItemType"/>
</xsd:schema>
내가 얻을 :
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlRootAttribute("TestSexItemType1", Namespace="", IsNullable=false)]
public enum sbrSexItemType {
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("1")]
Item1,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("2")]
Item2,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("3")]
Item3,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("0")]
Item0,
}
이 농담의 일종인가요? 오류조차 발생하지 않았습니다. 생성 된 코드는 어떤 모양이나 형태의 XSD를 어떻게 나타 냅니까?
아니요, 요점은 "TestSexItemType1"유형을 생성하는 대신 열거 형을 생성하고 유형을 "닮은"루트 요소를 지정합니다. 그렇다면 "TestSexItemType2"를 완전히 무시합니다. ... –
@SleeperSmith 전체 xsd에 대한 클래스가 있어야합니다. 어떻게 생겼어? – Botz3000
아니요. 그게 다야. –