Larry Brister
asked on
Group data from text file
I have a routine where I'm reading a text file into a list in the code below.
I need to modify this so that data is "grouped" based on starting and ending tags.
What I want is to group each xml block into one line
So...
<org.m5.api.v1.Response... . >
<ErrorCount>0</ErrorCount>
blah...blah...blah..
</org.m5.api.v1.Response>
Becomes
<org.m5.api.v1.Response><E rrorCount> 0</ErrorCo unt> blah..</org.m5.api.v1.Resp onse>
I need to modify this so that data is "grouped" based on starting and ending tags.
What I want is to group each xml block into one line
So...
<org.m5.api.v1.Response...
<ErrorCount>0</ErrorCount>
blah...blah...blah..
</org.m5.api.v1.Response>
Becomes
<org.m5.api.v1.Response><E
Dim list As New List(Of String)
' Open file.txt with the Using statement.
Using r As StreamReader = New StreamReader("C:\temp\Output.txt")
' Store contents in this String.
Dim line As String
' Read first line.
line = r.ReadLine
' Loop over each line in file, While list is Not Nothing.
Do While (Not line Is Nothing)
' Add this line to list.
list.Add(line)
'Me.ListBox1.Items.Add(line)
' Display to console.
'Console.WriteLine(line)
' Read in the next line.
line = r.ReadLine
Loop
End Using
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER