I have an object I'm deserializing which contains an enum 'JourneyPatternLinkDirectionEnumeration', it's used as a value for a node 'Direction'.
When 'Direction' is specified with a value, or not specified and it's represented in xml as
<Direction />
Everything works fine. However, if it's in the xml as
<Direction></Direction>
I get the following error:
"Instance validation error: '' is not a valid value for JourneyPatternLinkDirectionEnumeration."
My code is as follows:
var xmlTextReader = new XmlTextReader(xmlDocUri);
xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
xmlTextReader.Normalization = false;
var serializer = new XmlSerializer(typeof(T), typeof(T).Assembly.GetTypes());
ouput = (T)serializer.Deserialize(xmlTextReader);
Any thoughts? Is there a better way to do this.
(Sorry I can't post the full code, the xml doc is a 65000-line TransXchange doc)