Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / April 2007

Tip: Looking for answers? Try searching our database.

strings and input files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco Trapanese - 23 Apr 2007 19:00 GMT
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&apos;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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.