P
Peter Newman
Firstly a big thank you for the help pointing me in this direction, I have
managed to get this far ( section of code below) in reading a text file and
creating an XML file from it..
code
Do
Dim t As New Transaction
importLine = StripQuotes(sr.ReadLine)
If InStr(importLine, "TRAILER RECORD") Then Exit Do
' Set the values
t.LedgerRef = s.LedgerKey
t.Licence = s.License
s.Transactions.Add(t)
Loop Until InStr(importLine, "TRAILER RECORD") > 0
CLass
Imports System.Xml.Serialization
Imports System.IO
Public Class Transaction
Public _LedgerRef As String
<XmlAttribute("LedgerRef")> _
Public Property LedgerRef() As String
Get
Return _LedgerRef
End Get
Set(ByVal value As String)
_LedgerRef = value
End Set
End Property
Public _Licence As String
<XmlAttribute("Licence")> _
Public Property Licence() As String
Get
Return _Licence
End Get
Set(ByVal value As String)
_Licence = value
End Set
End Property
End Class
section ox XML result
<Transactions>
<Transaction LedgerRef="11111158908068131138" Licence="111111" >
<_LedgerRef>11111158908068131138</_LedgerRef>
<_Licence>111111</_Licence>
</Transaction>
<Transaction LedgerRef="22222258908068131138" Licence="222222" >
<_LedgerRef>22222258908068131138</_LedgerRef>
<_Licence>222222</_Licence>
</Transaction>
.. etc
what im trying to achieve is the following
<Transactions>
<Transaction LedgerRef="11111158908068131138" Licence="111111" />
<Transaction LedgerRef="22222258908068131138" Licence="222222" />
etc
any suggestions
managed to get this far ( section of code below) in reading a text file and
creating an XML file from it..
code
Do
Dim t As New Transaction
importLine = StripQuotes(sr.ReadLine)
If InStr(importLine, "TRAILER RECORD") Then Exit Do
' Set the values
t.LedgerRef = s.LedgerKey
t.Licence = s.License
s.Transactions.Add(t)
Loop Until InStr(importLine, "TRAILER RECORD") > 0
CLass
Imports System.Xml.Serialization
Imports System.IO
Public Class Transaction
Public _LedgerRef As String
<XmlAttribute("LedgerRef")> _
Public Property LedgerRef() As String
Get
Return _LedgerRef
End Get
Set(ByVal value As String)
_LedgerRef = value
End Set
End Property
Public _Licence As String
<XmlAttribute("Licence")> _
Public Property Licence() As String
Get
Return _Licence
End Get
Set(ByVal value As String)
_Licence = value
End Set
End Property
End Class
section ox XML result
<Transactions>
<Transaction LedgerRef="11111158908068131138" Licence="111111" >
<_LedgerRef>11111158908068131138</_LedgerRef>
<_Licence>111111</_Licence>
</Transaction>
<Transaction LedgerRef="22222258908068131138" Licence="222222" >
<_LedgerRef>22222258908068131138</_LedgerRef>
<_Licence>222222</_Licence>
</Transaction>
.. etc
what im trying to achieve is the following
<Transactions>
<Transaction LedgerRef="11111158908068131138" Licence="111111" />
<Transaction LedgerRef="22222258908068131138" Licence="222222" />
etc
any suggestions