Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

500pts: Specify XML field types i.e. Integer, string, DateTime so Dataset.ReadXML creates field types correct?

Posted on 2006-06-29
1
318 Views
Last Modified: 2011-09-20
Hi there,

I have written a webservice which returns an xml file. I was wondering if its possible to specify each field weather it contains a string or is a decimal,integer or datetime for example? As i use the ReadXml method of dataset to import the xml file, i think its importing each field as a string

here is an example of my XML file which my webservice returns, if anybody knows a solution i would be really grateful... Thanks in advance

specifically its fields NUM and VALUE which i would like to specify as "decimal" so that when i use ReadXML on the dataset object it would import these fields as decimals rather than strings

  <?xml version="1.0" encoding="utf-8" ?>
- <response>
  <Error code="0" description="OK" />
- <myData>
- <Record>
  <COD>abcd123</COD>
  <NOMBRE>company a</NOMBRE>
  <NUM>560</NUM>
  <VALUE>5250,39</VALUE>
  </Record>
- <Record>
  <COD>ccfg45</COD>
  <NOMBRE>Company b</NOMBRE>
  <NUM>30000</NUM>
  <VALUE>342900</VALUE>
  </Record>
  </myData>
  </response>
0
Comment
Question by:ianinspain
1 Comment
 
LVL 35

Accepted Solution

by:
mrichmon earned 500 total points
ID: 17011108
As far as I understand it is always going to read as a string if you use the ReadXml.  You can also read a schema in using the ReadXmlSchema and the datatypes can be defined in the schema:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatasetclassreadxmlschematopic.asp

Another option is to include the datatypes in the xml - but I think you may have to manually convert.

For example:

<value dt:dt="boolean">1</value>
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question