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
Chris Dunaway - 10 Mar 2008 15:48 GMT
On Mar 8, 8:20 am, Peter Newman
<PeterNew...@discussions.microsoft.com> wrote:
> 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
[quoted text clipped - 64 lines]
>
> any suggestions
You didn't show the code where you actually create the XML so my guess
is the problem is there. What you have posted seems ok at first
glance.
Chris
Chris Dunaway - 10 Mar 2008 15:49 GMT
On Mar 8, 8:20 am, Peter Newman
<PeterNew...@discussions.microsoft.com> wrote:
> 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
[quoted text clipped - 64 lines]
>
> any suggestions
Now at second glance, I think I see your problem. Your property
backing fields should be private not public:
Public _Licence As String
should be
Private _Licence As String
And the same for _LedgerRef
Chris