XML De-serialization giving null values

bouksou

New Member
i am having an XML string like\[code\]<?xml version="1.0"?><FullServiceAddressCorrectionDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <AuthenticationInfo xmlns="http://www.usps.com/postalone/services/UserAuthenticationSchema"> <UserId xmlns="">FAPushService</UserId> <UserPassword xmlns="">Password4Now</UserPassword> </AuthenticationInfo></FullServiceAddressCorrectionDelivery>\[/code\]In Order to map the nodes with Class, i am having the class structure like\[code\] [Serializable]public class FullServiceAddressCorrectionDelivery{ [XmlElement("AuthenticationInfo")] public AuthenticationInfo AuthenticationInfo { get; set; }}[Serializable]public class AuthenticationInfo { [XmlElement("UserId")] public string UserId { get; set; } [XmlElement("UserPassword")] public string UserPassword { get; set; }}\[/code\]For De-serialization , i used xmlserializer to De-serialize the object\[code\] byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(xmlString); MemoryStream stream = new MemoryStream(byteArray); XmlSerializer xs = new XmlSerializer(typeof(FullServiceAddressCorrectionDelivery)); var result = (FullServiceAddressCorrectionDelivery)xs.Deserialize(stream);\[/code\]but the value FullServiceAddressCorrectionDelivery object is always null..please help me what i am doing wrong here....
 
Back
Top