From: Peter on
Currently I've I'm keeping a log file, or history file of how one our app's
is used. I just have the app write data to a text file, so for each time it
is ran I'm appending a line of text that is comma separated.

The idea is that I can have another app read in that text file, and I'll be
able to sort or filter based up different data a user selects. I figure I
can write an app in C# that will parse the log file, and let a user select
the information they want to view, or take that text file, write in a XML
format, and I should have a easier time of sorting /filter on a XML file
versus a txt file

So my question is how, do I go from a text file, and create a XML file from
it?



From: Peter on
The format of the text file I've got is as follows
// Date, Start time, Elasped Time, Part Number

05/03/2010,17:05:04,00:00:31,1234567
05/03/2010,17:06:28,00:01:00,1234567
05/04/2010,07:34:51,00:00:53,1234567
05/04/2010,07:37:46,00:21:48,1234567
05/04/2010,08:16:45,00:18:38,1234567
05/04/2010,08:31:16,00:15::42,1234567

"Peter" <noMorespam(a)MSUK.com> wrote in message
news:%2310WGAU7KHA.3504(a)TK2MSFTNGP05.phx.gbl...
> Currently I've I'm keeping a log file, or history file of how one our
> app's is used. I just have the app write data to a text file, so for each
> time it is ran I'm appending a line of text that is comma separated.
>
> The idea is that I can have another app read in that text file, and I'll
> be able to sort or filter based up different data a user selects. I figure
> I can write an app in C# that will parse the log file, and let a user
> select the information they want to view, or take that text file, write in
> a XML format, and I should have a easier time of sorting /filter on a XML
> file versus a txt file
>
> So my question is how, do I go from a text file, and create a XML file
> from it?
>
>
>


From: Mr. Arnold on
Peter wrote:
> Currently I've I'm keeping a log file, or history file of how one our app's
> is used. I just have the app write data to a text file, so for each time it
> is ran I'm appending a line of text that is comma separated.
>
> The idea is that I can have another app read in that text file, and I'll be
> able to sort or filter based up different data a user selects. I figure I
> can write an app in C# that will parse the log file, and let a user select
> the information they want to view, or take that text file, write in a XML
> format, and I should have a easier time of sorting /filter on a XML file
> versus a txt file
>
> So my question is how, do I go from a text file, and create a XML file from
> it?
>


You make a accessor class/object like Person in the example that will
hold the data of the textfile and you XML serialize Person. You can use
Google to find out how to deserialize the XML back to an object read by
another program.

http://support.microsoft.com/kb/815813

From: "Mr. Arnold" MR. on

"Peter" <noMorespam(a)MSUK.com> wrote in message
news:uwqf0LU7KHA.5476(a)TK2MSFTNGP06.phx.gbl...
> The format of the text file I've got is as follows
> // Date, Start time, Elasped Time, Part Number
>
> 05/03/2010,17:05:04,00:00:31,1234567
> 05/03/2010,17:06:28,00:01:00,1234567
> 05/04/2010,07:34:51,00:00:53,1234567
> 05/04/2010,07:37:46,00:21:48,1234567
> 05/04/2010,08:16:45,00:18:38,1234567
> 05/04/2010,08:31:16,00:15::42,1234567


It's a comma delimited file. So use the Split statement and delimit the
record into variables.

You create a class call it Peter.

public class peter
{

public string TheDate {get; set;}
public string ST {get; set;}
// do ET and PN properties.

}


var peters = new List<peter>();

During the read of the text record, do the 'Split' into variables, which
would be 4 variables outputted.

var p = new peter();

p.TheDate = dt; // the variable populated by the Split

do the rest of them

peters.Add(p)


You then you Google and find out how to XML serialize a List<T> of objects
to an XML file, and deserialize the XML file of objects back to a List<T> of
objects.

It can't get any simpler than that.


From: Mr. Arnold on
Peter wrote:

<snipped>

And about the sort.......

<http://www.google.com/#hl=en&source=hp&q=list+t+sorting&aq=4&aqi=g5g-m1&aql=&oq=List%3CT%3E+sort&gs_rfai=&fp=7499efae2f902980>