Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
多个部分公共类的XML序列化_Xml_Vb.net_Xml Serialization - Fatal编程技术网

多个部分公共类的XML序列化

多个部分公共类的XML序列化,xml,vb.net,xml-serialization,Xml,Vb.net,Xml Serialization,我在尝试序列化使用xsd.exe工具生成的多个部分公共类时遇到了困难 我为每个类创建了新实例来填充细节,但似乎无法将它们序列化到一个xml文件中 Dim id As New Identifier 'partial class 1 id.Identifier_Type = "Material" id.Identifier_Value = "MAT/001" Dim id2 As New id2 'partial class 2 id2.st

我在尝试序列化使用xsd.exe工具生成的多个部分公共类时遇到了困难

我为每个类创建了新实例来填充细节,但似乎无法将它们序列化到一个xml文件中

    Dim id As New Identifier  'partial class 1
    id.Identifier_Type = "Material"
    id.Identifier_Value = "MAT/001"
    Dim id2 As New id2         'partial class 2
    id2.string = "stuff"
    id2.string2 = "more"
    id2.string3 = "Some Stuff"
    Dim id3 As New id3          'partial class 3
    id3.string ="type"

    Dim serializer As New XmlSerializer(id.GetType)

    Dim writer As TextWriter = New StreamWriter("c:\stack\text.xml")

    serializer.Serialize(writer, id)

    writer.Close()
我似乎得到的只是一个局部类,我如何才能将它们结合在一起

感谢

根据,有效的XML文件必须有且只有一个,例如:

<Identifier>
    <Identifier_Type>Material</Identifier_Type>
    <Identifier_Value>MAT/001</Identifier_Value>
</Identifier>
(甚至可能有这样一个类已经由
xsd.exe
为您自动生成。请使用所有三种标识符类型检查生成的类型。)

示例。

根据,有效的XML文件必须有且只有一个,例如:

<Identifier>
    <Identifier_Type>Material</Identifier_Type>
    <Identifier_Value>MAT/001</Identifier_Value>
</Identifier>
(甚至可能有这样一个类已经由
xsd.exe
为您自动生成。请使用所有三种标识符类型检查生成的类型。)

样品