0
我已生成的類使用XSD.EXE 具有參照其它XSD文件即鏈路使用以下命令無法XMLSERIALIZE從XSD.EXE生成一個類具有枚舉
xsd.exe file1.xsd linkfile.xsd /c
類XSD文件產生,但在file1.xsd我的complexType作爲
<xsd:complexType name="Department">
<xsd:annotation>
<xsd:documentation>Uses xlink: attributes to connect locations in the document or at any URL by defining an arc and arc type and role.</xsd:documentation>
</xsd:annotation>
<xsd:attributeGroup ref="xlink:deptLink"/>
<xsd:attribute name="SequenceNumber" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>An integer value used to provide an order to multi-instance sibling elements.</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
所述的xlink:deptLink即deptLink的complexType在linkfile.xsd文件,所以當我genearte使用上面提到的其命令類被創建字段枚舉類型內部部門類。
所以,當我嘗試使用
XmlSerializer serailizer = new XmlSerializer(typeof(MainClass));
我收到提示爲
'System.InvalidOperationException' 類型的未處理的異常出現在system.xml.dll的
生成XML附加信息:反映類型「MainClass」的錯誤。
爲了幫助名稱「類型」屬性xlink.xsd,我們需要一個完整的[ mcve],其中包含導致問題的XSD文件。見[問]。您還應該包含完整的'ToString()'異常輸出,包括消息,追蹤,異常類型*和內部異常*。內部例外通常解釋問題。 – dbc