using System.Xml.Serialization;
namespace Program
{
internal class Program
{
internal static void Main()
{
string xml =
@"<row>
<AI></AI>
</row>
";
XmlSerializer serializer = new XmlSerializer(typeof(row));
using (StringReader reader = new StringReader(xml))
{
row book = (row)(serializer.Deserialize(reader));
}
}
}
[Serializable]
public class row
{
[XmlElement(IsNullable = true)]
public int? AI;
}
}
It just does not work:
System.InvalidOperationException: 'There is an error in XML document (3, 15).'
If I feed xml to XDocument and try to serialize this document instead it does not work either.
StackOverflow compels me to write more letters about the issue, I don't know what else to say, I feel very sad and overwhelmed.