• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

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

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>
  <NOMBRE>company a</NOMBRE>
- <Record>
  <NOMBRE>Company b</NOMBRE>
1 Solution
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:


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>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now