wxsplvvpod
New Member
I have this XML element string: \[code\]<person name="jhon smith" birth="11/10/1988" username="ilearn" password="123"/>\[/code\]Now I want to deserialize this to its respective object:\[code\]public class CancelCardResponse{ public string name { get; set; } public string birth { get; set; } public string username { get; set; } public string password { get; set; }}\[/code\]I'm using a code similar to this:\[code\]XmlSerializer deserializer = new XmlSerializer(typeof(Person));StringReader reader = new StringReader(myxmlelementstring);var a = deserializer.Deserialize(reader); // fail!\[/code\]The error says something like: \[quote\] System.InvalidOperationException {"There is an error in XML document (1,2)."}\[/quote\]Is it possible to derserialize an XML element string like the one above?
Is there something I can add to my XML element string to use the C# deserializer?
Is there something I can add to my XML element string to use the C# deserializer?