I am trying to deserialize an OFX xml document into its object (I converted the XSD's to classes)
Here is the code below.
XmlSerializer xmlSerializer = new XmlSerializer(typeof(OFX));
using (var reader = xmlDoc.Root.CreateReader())
{
return (OFXRequest)xmlSerializer.Deserialize(reader);
}
It fails on newing up of the xml XmlSerializer with the error
The xml doc:
<?OFX OFXHEADER=200 VERSION=211 SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE" ?>
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20120202</DTCLIENT>
<USERID>USER-ID</USERID>
<USERPASS>PASSWORD</USERPASS>
<LANGUAGE>ENG</LANGUAGE>
<FI>
<ORG>Organisation</ORG>
<FID>OrganisationID</FID>
</FI>
<APPID>YOD</APPID>
<APPVER>1</APPVER>
</SONRQ>
</SIGNONMSGSRQV1>
<SIGNUPMSGSRQV1>
<ACCTINFOTRNRQ>
<TRNUID>456579841231</TRNUID>
<ACCTINFORQ>
<DTACCTUP>2013101209000.000[2:GMT]</DTACCTUP>
</ACCTINFORQ>
</ACCTINFOTRNRQ>
</SIGNUPMSGSRQV1>
</OFX>
The Error:
Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'System.DateTime' to 'string' error CS0030: Cannot convert type 'System.DateTime' to 'string' error CS0030: Cannot convert type 'System.DateTime' to 'string'
What I need do know is how do I find the exact place in code that is failing whilst deserializing? There is no inner exception etc.
At a guess, it is confused what you want it do do with things like this
which clearly says "treat the values as a string", verses this:
which clearly wants values to be a
DateTime
.