【发布时间】:2011-07-04 20:35:07
【问题描述】:
我有一个具有以下 xml 结构的 xsd 文件。无论我做什么,都不会生成 MyVals 枚举器。
<xs:simpleType name="MyVals">
<xs:restriction base="xs:string">
<xs:enumeration value="1" />
<xs:enumeration value="2" />
<xs:enumeration value="3" />
<xs:enumeration value="4"/>
</xs:restriction>
</xs:simpleType>
所有其他结构都正确填充。完整的 xsd 如下所示。
<?xml version="1.0"?>
<xs:schema targetNamespace="http://www.simple.com/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="1.0"
xmlns:wepa="http://www.simple.com/xsd"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
>
<xs:element name="MessageProtocol" >
<xs:complexType >
<xs:sequence>
<xs:element name ="Header" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name ="Body" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="MyVals">
<xs:restriction base="xs:string">
<xs:enumeration value="1" />
<xs:enumeration value="2" />
<xs:enumeration value="3" />
<xs:enumeration value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
XSD 生成命令:C:\Progra~1\"Microsoft SDKs"\Windows\v6.0A\bin\xsd.exe -c /enabledDataBinding -l:c# /namespace:Simple.SimpleXSD Simple.xsd
【问题讨论】: