0

I'm currently trying to map an xsd-file to an xml-file that im creating. Althought, when I'm adding the xsi-attribute it doesnt map straight to the existing Customer-object. It creats a new customer-object and maps to that one instead. I have the folling code to export an xml-file.

    Public Sub ExportCustomerAccount(result As Worker.Result)
        
        Dim customers = CustomerMapper.MapCustomer(result)
        Dim serialize As New System.Xml.Serialization.XmlSerializer(GetType(CustomerAgreement))
        
        Dim stream As New System.IO.StreamWriter(  "C:\xmlexports\test.xml")
        Dim xmlWriter = System.Xml.XmlWriter.Create(stream)

        xmlWriter.Flush()
        
        xmlWriter.WriteStartElement("Customer")
        xmlWriter.WriteAttributeString("xmlns", "xsi", Nothing, "file://C://somthing.xsd")
        
        serialize.Serialize(xmlWriter, customer)  
        xmlWriter.Close()
        
    End Sub 
    
        

Anyone has any good tips when mapping an xsd-file to and xml-file.

0 Answers0