473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

strings and input files

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
Apr 23 '07 #1
2 987
Marco Trapanese wrote:
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.
Apr 24 '07 #2
Phill W. wrote:
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>

[cut]

Thank you for your answer,
I will try this way!

Marco / iw2nzm
Apr 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
6
by: qwweeeit | last post by:
For a python code I am writing I need to remove all strings definitions from source and substitute them with a place-holder. To make clearer: line 45 sVar="this is the string assigned to sVar"...
6
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being...
5
by: Robert Manea | last post by:
Hello everyone, I wrote, simply as an exercise, a small piece of code to find 'strings' (defined as an amount of at least 3 ASCII characters followed by a non ASCII character) in binary files. ...
7
by: arkobose | last post by:
hey everyone! i have this little problem. consider the following declaration: char *array = {"wilson", "string of any size", "etc", "input"}; this is a common data structure used to store...
25
by: Rainmaker | last post by:
Hi, Can anyone tell me an efficient algorithm to sort an array of strings? Keep in mind that this array is HUGE and so the algorithm should me efficient enough to deal with it. Thanks
4
by: Kza | last post by:
Hi, just in the process of maintaining some software that used some funy old string library and char*s , and we are updating everything to use std::strings. (or should I say std::basic_string<>s) ...
2
by: Potiuper | last post by:
Question: Is it possible to use a char pointer array ( char *<name> ) to read an array of strings from a file in C? Given: code is written in ANSI C; I know the exact nature of the strings to be...
20
by: tomPee | last post by:
Hi, I've bumbed into a slight problem now, and I just don't seem to know how to fix it. What I want to do is the following: Send over a socket: 1. Number of files to be send (not as an integer,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.