Hi guys
I am trying to create a SAFT file
http://www.oecd.org/ctp/taxadministr...quirements.htm
I have the following class
when i serialize the object i getCode:Imports System.ComponentModel <TypeConverter(GetType(ExpandableObjectConverter))> _ Public Class Header Private _companyAddress As List(Of CompanyAddress) Public Property AuditFileVersion As String Public Property CompanyID As String Public Property TaxRegistrationNumber As String Public Property CompanyAddress() As List(Of CompanyAddress) Get Return _companyAddress End Get Set(ByVal value As List(Of CompanyAddress)) _companyAddress = value End Set End Property Public Sub New() _companyAddress = New List(Of CompanyAddress) End Sub End Class Public Class CompanyAddress Public Property AddressDetail As String Public Property City As String Public Property PostalCode As String Public Property Country As String End Class
as you can see i get <CompanyAddress> element repeated...Code:<Header> <AuditFileVersion>1.1.0</AuditFileVersion> <CompanyAddress> <CompanyAddress> <City>Porto</City> <PostalCode>4100</PostalCode> </CompanyAddress> <CompanyAddress> <City>Porto</City> <PostalCode>4100</PostalCode> </CompanyAddress> <CompanyAddress> <City>Porto</City> <PostalCode>4100</PostalCode> </CompanyAddress> </CompanyAddress> </Header>
The result i want to produce is something like this:
with only one element created for each item (CompanyAddress)Code:<Header> <AuditFileVersion>1.1.0</AuditFileVersion> <CompanyAddress> <City>Porto</City> <PostalCode>4100</PostalCode> </CompanyAddress> <CompanyAddress> <City>Porto</City> <PostalCode>4100</PostalCode> </CompanyAddress> <CompanyAddress> <City>Porto</City> <PostalCode>4100</PostalCode> </CompanyAddress> </Header>
Any help ?



Reply With Quote