Hello,
I have to define a structure for a plain-text input file.
It should have some general text fields and a long table of values.
These values are grouped by rows and can be integers, floats, strings.
Here an example:
Title
Description
Others...
val11, val12, val13
val21, val22, val23
Where valxy could be:
10
45.2
Hello! This is a string, indeed.
-56.1234
Well, I have a couple of questions:
1) should I use an xml file?
Something like this:
<header>
Title
Description
Others...
</header>
<data>
val11, val12, val13
val21, val22, val23
</data>
2) how can I manage strings? Strings might contain ',' that is the
separator character. If I use double quotes ( "mystring" ) does VB
understand it's a string?
Thanks
Marco / iw2nzm
Phill W. - 24 Apr 2007 12:02 GMT
> I have to define a structure for a plain-text input file.
> 1) should I use an xml file?
Yes!
Bear in mind that Xml is good for holding things and retrieving them,
but not so good at extracting values and then breaking them up (you have
to code for that) so break your data down as far as you (sensibly) can,
then you can read and reassemble items later.
Something like this would do:
<file>
<header
title="W"
description="X"
other_1="Y"
other_2="Z"
/>
<data>
<row number="1">
<col number="1" >10</col>
<col number="2" >45.2</col>
<col number="3" >Hello! This is a string, indeed.</col>
</row>
<row number="2">
<col number="1" >-56.1234</col>
<col number="2" >Gilligan's Island</col>
<col number="3" >42</col>
</row>
</data>
</file>
> 2) how can I manage strings? Strings might contain ',' that is the
> separator character.
Single quotes have to be escaped/encoded as &apos but, if you use any of
the Xml classes to manipulate your data (System.Xml Namespace), this
will all be taken care of for you.
HTH,
Phill W.
Marco Trapanese - 24 Apr 2007 12:49 GMT
> Yes!
> Bear in mind that Xml is good for holding things and retrieving them,
[quoted text clipped - 24 lines]
> </data>
> </file>
[cut]
Thank you for your answer,
I will try this way!
Marco / iw2nzm