<?xml version="1.0" encoding="UTF-8"?>
<NewDataSet>
<xs:schema xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="NewDataSet">
<xs:element msdata:IsDataSet="true" msdata:UseCurrentLocale="true" name="NewDataSet">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="Table1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="CODE" type="xs:string"/>
<xs:element minOccurs="0" msdata:DateTimeMode="Unspecified" name="MAXTIME" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<Table1>
<CODE>A112</CODE>
<MAXTIME/>
</Table1>
<Table1>
<CODE>A113</CODE>
<MAXTIME>2018-03-13T00:00:00</MAXTIME>
</Table1>
</NewDataSet>
I want to convert xml string above to Dataset with this schema, but when I using that code below:
DataSet dataSet = new DataSet();
dataSet.ReadXml(xmlPath, XmlReadMode.ReadSchema);
it throw exception because <MAXTIME>
field is empty
The string '' is not a valid AllXsd value.
So how to convert it with null able Datetime field without changing the schema?
I can not change the input xml file, as it is provided by my customer, so I need a solution besides adding attributes to the fields.