我尝试使用xsd.exe将xsd文件转换为cs
xsd文件
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.test.com/ebpp/IFXMessages/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.test.com/ebpp/IFXMessages/">
<include schemaLocation="CoreLib.xsd"></include>
<complexType name="AccountTypeDetailsRqType">
<sequence>
<element name="RecCtrlIn" type="tns:RecCtrlInType"
minOccurs="0" maxOccurs="1">
</element>
<element name="DeliveryMethod" type="tns:DeliveryMethodOpenEnum" minOccurs="1" maxOccurs="1"></element>
<element name="FetchAll" minOccurs="1" maxOccurs="1"
type="boolean" />
<element name="AcctTypes" minOccurs="0" maxOccurs="1"
type="tns:AcctTypesType" />
</sequence>
</complexType>
<complexType name="AcctTypesType">
<sequence>
<element name="AcctType" minOccurs="1" maxOccurs="unbounded" type="tns:AcctTypeOpenEnum"/>
</sequence>
</complexType>
<complexType name="AccountTypeDetailsRsType">
<sequence>
<element name="RecCtrlOut" type="tns:RecCtrlOutType"
minOccurs="0" maxOccurs="1">
</element>
<element name="DeliveryMethod" type="tns:DeliveryMethodOpenEnum" minOccurs="0" maxOccurs="1"></element>
<element name="AccountTypeDetailsRecs" minOccurs="0"
maxOccurs="1" type="tns:AccountTypeDetailsRecsType" />
</sequence>
</complexType>
<complexType name="AccountTypeDetailsRecsType">
<sequence>
<element name="AcctTypeDetailsRec" minOccurs="1" maxOccurs="unbounded" type="tns:AcctTypeDetailsRecType"/>
</sequence>
</complexType>
<complexType name="AcctTypeDetailsRecType">
<sequence>
<element name="AcctTypeCode" minOccurs="1" maxOccurs="1"
type="tns:AcctTypeOpenEnum" />
<element name="NamePrimLang" minOccurs="1" maxOccurs="1"
type="tns:C40_Type" />
<element name="NameSecLang" minOccurs="1" maxOccurs="1"
type="tns:C160_Type" />
<element name="DescPrimLang" minOccurs="0" maxOccurs="1"
type="tns:C80_Type" />
<element name="DescSecLang" minOccurs="0" maxOccurs="1"
type="tns:C320_Type" />
<element name="AcctTypeStatus" minOccurs="1" maxOccurs="1"
type="tns:AcctTypeStatusOpenEnum" />
<element name="IsDefault" type="boolean" maxOccurs="1" minOccurs="1"></element>
<element name="PmtSchemeCode" minOccurs="0" maxOccurs="1"
type="tns:Identifier_Type" />
<element name="ActivationMethods" minOccurs="0" maxOccurs="1"
type="tns:ActivationMethodsType" />
<element name="AcctTypeParameters" minOccurs="0" maxOccurs="1"
type="tns:AcctTypeParametersType" />
</sequence>
</complexType>
<complexType name="ActivationMethodsType">
<sequence>
<element name="ActivationMethod" minOccurs="1" maxOccurs="1" type="tns:ActivationMethodType"/>
</sequence>
</complexType>
<complexType name="ActivationMethodType">
<sequence>
<element name="ActivationMethodCode" minOccurs="1" maxOccurs="1"
type="tns:Identifier_Type" />
<element name="NamePrimLang" minOccurs="1" maxOccurs="1"
type="tns:C40_Type" />
<element name="NameSecLang" minOccurs="1" maxOccurs="1"
type="tns:C160_Type" />
<element name="DescPrimLang" minOccurs="0" maxOccurs="1"
type="tns:C80_Type" />
<element name="DescSecLang" minOccurs="0" maxOccurs="1"
type="tns:C320_Type" />
<element name="IsDefault" type="boolean" maxOccurs="1" minOccurs="1"/>
<element name="ActivationMethodStatus" minOccurs="1" maxOccurs="1"
type="tns:ActivationMethodStatusOpenEnum" />
</sequence>
</complexType>
<complexType name="AcctTypeParametersType">
<sequence>
<element name="AcctProfile" minOccurs="1" maxOccurs="unbounded" type="tns:AcctProfileType"/>
</sequence>
</complexType>
<complexType name="AcctProfileType">
<sequence>
<element name="AcctTypeProfileCode" minOccurs="1" maxOccurs="1" type="tns:Identifier_Type" />
<element name="AcctTypeParameter" minOccurs="1" maxOccurs="unbounded" type="tns:AcctTypeParameterType"/>
</sequence>
</complexType>
<complexType name="AcctTypeParameterType">
<sequence>
<element name="ParameterCode" minOccurs="1" maxOccurs="1"
type="tns:Identifier_Type" />
<element name="NamePrimLang" minOccurs="1" maxOccurs="1"
type="tns:C40_Type" />
<element name="NameSecLang" minOccurs="1" maxOccurs="1"
type="tns:C160_Type" />
<element name="DescPrimLang" minOccurs="0" maxOccurs="1"
type="tns:C80_Type" />
<element name="DescSecLang" minOccurs="0" maxOccurs="1"
type="tns:C320_Type" />
<element name="Value" minOccurs="0" maxOccurs="1"
type="tns:C80_Type" />
</sequence>
</complexType>
</schema>
我写了这个命令行代码:
xsd /c AccountTypeDetailsContent.xsd /n:test.namespace
文件未生成,它会向我显示此消息
Microsoft(R)Xml架构/数据类型支持实用程序[Microsoft(R) .NET Framework,版本4.6.1055.0]版权所有(C)Microsoft 公司。版权所有。警告:无法生成类 因为没有找到具有复杂类型的顶级元素。
答案 0 :(得分:0)
由于XSD架构仅包含类型,因此无法生成类。不幸的是,xsd.exe不支持此功能。我看到几种方法: