我有多个描述对象的XSD文件。我想从这些对象中生成类,以便我可以解析一个XML并创建该对象。我用xsd.exe
该Visual Studio提供如下:xsd.exe类生成器问题与多个xsd文件
XSD/C efreight-CommonReportingSchema-1.0.xsd ../common/efreight-CommonReportingSchemaExtensions-1.0.xsd ../common/UBL-CommonAggregateComponents-2.1的.xsd ../common/UBL-CommonBasicComponents-2.1.xsd ../common/UBL-UnqualifiedDataTypes-2.1.xsd
的efreight-CommonReportingSchema-1.0.xsd
文件:
<!-- ===== Imports ===== -->
<xsd:import namespace="urn:eu:specification:efreight:schema:xsd:CommonReportingSchemaExtensions-1.0" schemaLocation="../common/efreight-CommonReportingSchemaExtensions-1.0.xsd"/>
<xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" schemaLocation="../common/UBL-CommonAggregateComponents-2.1.xsd"/>
<xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" schemaLocation="../common/UBL-CommonBasicComponents-2.1.xsd"/>
<xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2" schemaLocation="../common/UBL-UnqualifiedDataTypes-2.1.xsd"/>
<!-- ===== Common Reporting Schema Definition ===== -->
<xsd:element name="CommonReportingSchema" type="CommonReportingSchemaType">
</xsd:element>
<xsd:complexType name="CommonReportingSchemaType">
<xsd:sequence>
<xsd:element ref="cbc:UBLVersionID" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="cbc:CustomizationID" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="cbc:ProfileID" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="cbc:ID" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="cbc:VersionID" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="cbc:TransportExecutionPlanReferenceID" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="crs:SubmissionDate" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="crs:SubmissionTime" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="crs:ReportingParty" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="crs:Consignment" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="crs:TransportMeans" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="cac:DocumentReference" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
的CS文件被成功生成,但是当我尝试分析对象,会出现类似下面几个错误:
错误CS0266:无法隐式转换类型“ShipmentStageType [ ]'至 'ShipmentStageType1 []'。一个显式转换存在(是否缺少 强制转换?)
错误CS0266:无法隐式转换类型 'TransportHandlingUnitType []' 到 'TransportHandlingUnitType1 []'。一个 显式转换存在(是否缺少强制转换?)
错误CS0266:无法隐式转换类型 'ConsignmentType []' 到 'ConsignmentType1 []'。一个显式转换存在(是否缺少 投?)
我从错误中看到的是,出事了班上的产生。我认为有几个类被声明了两次,这就是为什么'1'被放在名称末尾的原因。
是否有某种配置更改可用于xsd.exe
?或者是由其他地方引起的错误?
谢谢。