473,419 Members | 1,544 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,419 software developers and data experts.

Creating a column of type Double from a node in an XML file

Hi,

I'm using a dataset to read data from an XML file. I don't control the XML.
The XML has no schema and therefore is treated like a string. My data
consumer wants the column type to be a Double.

Is there a simple way to change a column from string to double? When I try
to do it, the compiler complaints that I can't change the type after the
data is loaded. Maybe there's a way to do a mapping or alias? Can I create
my own schema and apply it after the data is loaded?

Thanks,

Ken

Nov 19 '05 #1
1 1161
Ken,

You can create a schema at load time using inference to determine your
types - I've not done it though and its not intuitive. The schema
over-rides inference as inference is pretty much guess work on the part of
the reader.

http://msdn.microsoft.com/library/de...urefromxml.asp

Your best bet is create a schema if the data columns are fixed at read time
and rewrite the XML with an inline schema and provide that to your consumer.
These links provide some good examples but you'll need to pick them apart...

http://msdn.microsoft.com/library/de...setfromxml.asp

http://msdn.microsoft.com/library/de...ionfromxml.asp
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:u5**************@TK2MSFTNGP15.phx.gbl...
Hi,

I'm using a dataset to read data from an XML file. I don't control the XML. The XML has no schema and therefore is treated like a string. My data
consumer wants the column type to be a Double.

Is there a simple way to change a column from string to double? When I try
to do it, the compiler complaints that I can't change the type after the
data is loaded. Maybe there's a way to do a mapping or alias? Can I create
my own schema and apply it after the data is loaded?

Thanks,

Ken

Nov 19 '05 #2

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

Similar topics

9
by: soni29 | last post by:
hi, i have written the following code, still in the learning stage: #include<iostream.h> class CBox { public: // Constructor definition CBox(double lv, double bv = 1.0, double hv = 1.0) :...
7
by: Yngve | last post by:
Hi! I am trying to make two pointers at instances of the same class wich is beeing defined. But i get the following error from the compiler (MVC7): -------------------- ...
2
by: David Elliott | last post by:
I am creating a configuration class to read / write a standard configuration file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="ConnectionString"...
6
by: Ferrari, Eduardo | last post by:
Hi all! I'm trying to create this XML file: <?xml version="1.0" encoding="utf-8" ?> <Build type="Daily" sync="True" compile="True" assemble="True" > <Sync version="1.0.0.0" branch="QA">...
3
by: Bob Gabor | last post by:
Running 8.1 w/FP5 on Windows 2000. Everytime I try to create a stored procedure, I get the following error saying that my database is damaged: DB21034E The command was processed as an SQL...
4
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; }; ...
8
by: Nanda | last post by:
hi, I am trying to generate parameters for the updatecommand at runtime. this.oleDbDeleteCommand1.CommandText=cmdtext; this.oleDbDeleteCommand1.Connection =this.oleDbConnection1;...
4
by: Frank-René Schäfer | last post by:
-- A class needs to have N members according to N types mentioned in a typelist (possibly with one type occuring more than once). -- The classes should be generated **avoiding** multiple...
1
by: Sharon | last post by:
I need to write an XML document, that other users can work with to change values and to add elements. My problem is that for each element that me or any other user will add, should have some...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.