Hi,
I have a comma seperated file which I use to store data, and a
simplified version of it looks like this -
TestPeriod1 , ,
,TestTime , 55
,TestAction ,
, Phase1
, Phase2
,RunTest ,
, Test1
, Test2
, Test2
,
Test1
TestPeriod2 , ,
,TestTime , 10
,TestAction , Phase2
,RunTest , Test1
TestPeriod3 , ,
,TestAction , Phase1
,RunTest , Test2
Since I have no TestTime for TestPeriod3, I use a default time. Note
also that TestPeriod1's TestAction has two values - Phase1 and Phase2,
and its RunTest has 4 values, with Test1 and Test2 appearing twice.
What I'd like to do is represent this data structure in c# using a
class called TestInformation. This class would then contain an array
of type TestPeriod used to store TestPeriod1, TestPeriod2 etc. The
TestPeriod class would then contain a TestTime Member, an array of
type TestAction and an array of type RunTest.
Now as I said, the above is a simplification of what I'm actually
using and this structure is subject to change over time. Therefore,
I'm thinking that my first stage might be to convert the above comma
seperated file to xml first. Would you recommend this step? If so, how
would you represent in xml the fact that TestPeriod1's TestAction has
two values Phase1 and Phase2, and that the Test1 and Test2 values are
represented twice?
Secondly, once in xml format, how difficult would it be to serialize
an object of type TestInformation from my xml file?
Any other suggestions or tips?
Thanks,
Barry. 3 3960
on the second question on how to serialize an object to XML by using
Visual C#
Here is the code
using System;
public class clsPerson
{
public string FirstName;
public string MI;
public string LastName;
}
class class1
{
static void Main(string[] args)
{
clsPerson p=new clsPerson();
p.FirstName = "Jeff";
p.MI = "A";
p.LastName = "Price";
System.Xml.Serialization.XmlSerializer x = new
System.Xml.Serialization.XmlSerializer(p.GetType() );
x.Serialize(Console.Out, p);
Console.WriteLine();
Console.ReadLine();
}
}
Regards http://www.auratius.co.za
Auratius
what is this really.. is this a index page of a book.. or is this some thing
else..
If this -",TestTime , 55" is correct then you have treat this as a node
int the XML and
here in this -,TestAction , case you have to treat Phase 1 and 2 as two
node in the XML with a attribute.
, Phase1
, Phase2
You have to take the /r/n to identify new nodes but in case one you have to
hevily depend on the attribute you add to indentyfy the node and seperate it
as you create the class..
Answering to the question of whether the approach to create a XML in the
middle.. it heavily depend on your requirement, you don't have to create a
XML if you do not want your data to be converted to a nutral format before
the processing.. I would rather avoid the comma seperated file and evaluate
the possibility of creating the XML at the first place itself, and failing
that, I would prefer not to create a XML in the middle.. but it all depend
on what you are trying to achieve here..
Nirosh.
<bg***@yahoo.comwrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
Hi,
I have a comma seperated file which I use to store data, and a
simplified version of it looks like this -
TestPeriod1 , ,
,TestTime , 55
,TestAction ,
, Phase1
, Phase2
,RunTest ,
, Test1
, Test2
, Test2
,
Test1
TestPeriod2 , ,
,TestTime , 10
,TestAction , Phase2
,RunTest , Test1
TestPeriod3 , ,
,TestAction , Phase1
,RunTest , Test2
Since I have no TestTime for TestPeriod3, I use a default time. Note
also that TestPeriod1's TestAction has two values - Phase1 and Phase2,
and its RunTest has 4 values, with Test1 and Test2 appearing twice.
What I'd like to do is represent this data structure in c# using a
class called TestInformation. This class would then contain an array
of type TestPeriod used to store TestPeriod1, TestPeriod2 etc. The
TestPeriod class would then contain a TestTime Member, an array of
type TestAction and an array of type RunTest.
Now as I said, the above is a simplification of what I'm actually
using and this structure is subject to change over time. Therefore,
I'm thinking that my first stage might be to convert the above comma
seperated file to xml first. Would you recommend this step? If so, how
would you represent in xml the fact that TestPeriod1's TestAction has
two values Phase1 and Phase2, and that the Test1 and Test2 values are
represented twice?
Secondly, once in xml format, how difficult would it be to serialize
an object of type TestInformation from my xml file?
Any other suggestions or tips?
Thanks,
Barry.
I think you'll find it easier to read the data into a custom object
sturcture directly instead of working with XML. Then if you need XML
you can serialize that custom object out as XML but that would be
totally unrelated to the CSV format.
HTH,
Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On 29 Mar 2007 03:33:55 -0700, bg***@yahoo.com wrote:
>Hi,
I have a comma seperated file which I use to store data, and a simplified version of it looks like this -
TestPeriod1 , ,
,TestTime , 55
,TestAction ,
, Phase1
, Phase2
,RunTest ,
, Test1
, Test2
, Test2
, Test1 TestPeriod2 , ,
,TestTime , 10
,TestAction , Phase2
,RunTest , Test1
TestPeriod3 , ,
,TestAction , Phase1
,RunTest , Test2
Since I have no TestTime for TestPeriod3, I use a default time. Note also that TestPeriod1's TestAction has two values - Phase1 and Phase2, and its RunTest has 4 values, with Test1 and Test2 appearing twice.
What I'd like to do is represent this data structure in c# using a class called TestInformation. This class would then contain an array of type TestPeriod used to store TestPeriod1, TestPeriod2 etc. The TestPeriod class would then contain a TestTime Member, an array of type TestAction and an array of type RunTest.
Now as I said, the above is a simplification of what I'm actually using and this structure is subject to change over time. Therefore, I'm thinking that my first stage might be to convert the above comma seperated file to xml first. Would you recommend this step? If so, how would you represent in xml the fact that TestPeriod1's TestAction has two values Phase1 and Phase2, and that the Test1 and Test2 values are represented twice?
Secondly, once in xml format, how difficult would it be to serialize an object of type TestInformation from my xml file?
Any other suggestions or tips?
Thanks,
Barry.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: unknow |
last post by:
I want to do a serialisation in pure C++ but i don't know how. Do you have
some useful links ?
Thanks
|
by: msnews.microsoft.com |
last post by:
Hi
Here is another EASY question
When you serialise an object in .NET, serialisation adds defaut attributes
that I dont care
EXEMPLE :
<root_test...
|
by: lobrys |
last post by:
Hi everybody
here is a question
I have this class that a want to serialize :
Public Class BOO
<XmlAttributeAttribute()> Public THING As String
<XmlElementAttribute("param")> Public p() As...
|
by: lobrys |
last post by:
Hi everybody
what are the objets for the folowing XML serialisation :
(I have problem with "name" and "datatype")
<vehicule type="car">
<name datatype="String">Megane</name>
</inventory>
...
|
by: Ollie |
last post by:
I have been able to get simple circular references to be serialized in
xml by using the ImportTypeMapping method on the
SoapReflectionImporter class.
But I am unable to serialise circular...
|
by: McGiv |
last post by:
Hi,
I'm trying to serialise some objects and I've can't get the built in
serialisation to output exactly what I want. For the moment I'm
implementing the IXmlSerializable interface and doing it...
|
by: BrentonMCA |
last post by:
I want to be able to serialise an object and then pass the serialisation text
as a string to a Web service without serialising to a file first.
I also want to be able to deserialise from the text...
|
by: Greg |
last post by:
I have a bizarre situation in which serialisation is failing routinely
under a specific condition, and I'm wondering if the details ring a
bell with anyone here.
I have 2 classes that my...
|
by: ashwinij |
last post by:
Hello
The steps which i am doing in my program
1) I am having an xml file.
2) I am performing some updations in the file using XQueryUtil class from nux package.
3)After that i am...
|
by: OrionLee |
last post by:
I am using C# to work with a 3rd party DLL (Nevron Charts), and attempting to serialise it. The serialisation itself is handled somewhere inside the DLL, so to get it to happen you call the Nevron's...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
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...
|
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...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
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...
|
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)...
|
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...
|
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....
|
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
| |