xs:date values and strongly typed Datasets



I have an xsd that I has been run through the MSDataSetGenerator in Visual Studio.


My date columns in the xsd are defined as xs:date (example below):



<xs:element name="DateDeath" type="xs:date" minOccurs="1"/>


I write the data into the row of my strongly typed dataset class like this:



myRow["DateDeath"] = "1933-01-01"


When I call WriteXml() on the dataset to generate the xml file, the xml file has DateTime values:



<DateDeath>1933-01-01T00:00:00-05:00</DateDeath>


The problem I am having is that when I load the created xml file and try to validate it, I get errors that complain that the date is not valid. If I manually remove the time related stuff (the T and everything after it) the errors go away.


How can I get the strongly typed dataset to write the xml so that it can be validated against the xsd (i.e. discard the time and timezone information)?


No comments:

Post a Comment