Solved

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

Posted on 2006-06-29
1
321 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
[X]
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
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

687 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