Problem with XML Deserialization C?

I hope this helps. The XML structure implies the result element can occur more than once, so see if this helps you achieve what you need.

I hope this helps. The XML structure implies the element can occur more than once, so see if this helps you achieve what you need: using System; using System.Collections. Generic; using System.Xml.

Serialization; using System. Xml; namespace XMLSerializationHelp { class Program { static void Main(string args) { string strXML = @" 1 OK 12345 012345678 054321 Testing f8d3eea1cbf6771a4bb02af3fb15253e "; XmlSerializer serializer = new XmlSerializer(typeof(SMSSendingResponse)); SMSSendingResponse obj = (SMSSendingResponse)serializer. Deserialize(new XmlTextReader(strXML, XmlNodeType.

Document, null)); Console. WriteLine("Status: {0}", obj. Status); Console.

WriteLine("Message: {0}", obj. Message); Console. WriteLine("Account Number: {0}", obj.

AccountNumber); Console. WriteLine("ResponseID: {0}", obj. ResponseID); Console.

WriteLine("To: {0}", obj. To); Console. WriteLine("From: {0}", obj.

From); Console. WriteLine("ResultMessage: {0}", obj. ResultMessage); Console.ReadLine(); } } Serializable XmlRoot("data") public class SMSSendingResponse { public SMSSendingResponse() {} //should come from the "status" xml element XmlElement("status") public string Status { get; set; } //should come from the "message" xml element (in our example - "OK") XmlElement("message") public string Message { get; set; } //should come from the results/result/account element.In our example "12345" XmlIgnore() public string AccountNumber { get { Result r = FirstResult; return (r!

= null)? R. AccountNumber : null; } } //should come from the "id" xml element (in our example - "f8d3eea1cbf6771a4bb02af3fb15253e") XmlIgnore() public string ResponseID { get { Result r = FirstResult; return (r!

= null)? R. ResponseID : null; } } XmlIgnore() public string To { get { Result r = FirstResult; return (r!

= null)? R.To : null; } } XmlIgnore() public string From { get { Result r = FirstResult; return (r! = null)?

R. From : null; } } XmlIgnore() public string ResultMessage { get { Result r = FirstResult; return (r! = null)?

R. Message : null; } } XmlArray("results"), XmlArrayItem("result", typeof(Result)) public List Results { get { return (_Results); } set { _Results = value; } } private List _Results = new List(); XmlIgnore() public Result FirstResult { get { return (_Results! = null && _Results.

Count > 0)? _Results0 : null; } } } XmlType(TypeName = "result"), Serializable public class Result { public Result() {} XmlElement("account") public string AccountNumber { get; set; } XmlElement("to") public string To { get; set; } XmlElement("from") public string From { get; set; } XmlElement("message") public string Message { get; set; } XmlElement("id") public string ResponseID { get; set; } } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions