XML : XmlSerializer.Deserialize() keeps return null and throws no error

I'm trying to deserialize responce from web service.

Responce:

  <?xml version="1.0" encoding="UTF-8"?>    <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">      <currency>        <id><![CDATA[1]]></id>        <name><![CDATA[Złoty]]></name>        <iso_code><![CDATA[PLN]]></iso_code>        <iso_code_num><![CDATA[985]]></iso_code_num>        <blank><![CDATA[1]]></blank>        <sign><![CDATA[zł]]></sign>        <format><![CDATA[2]]></format>        <decimals><![CDATA[1]]></decimals>        <conversion_rate><![CDATA[1.000000]]></conversion_rate>        <deleted><![CDATA[0]]></deleted>        <active><![CDATA[1]]></active>      </currency>    </prestashop>    

My class code:

  public class prestashop  {     Currency currency;  }    public class Currency  {      public int id;      public string name;      public string iso_code;      public int iso_code_num;      public int blank;      public string sign;      public int format;      public int decimals;      public float conversion_rate;      public bool deleted;      public bool active;  }    

And finally part where I try to deserialize:

  Prestashop_WebClient client = new Prestashop_WebClient();  prestashop objpresta = new prestashop();  StreamReader strumien = client.ReadRecord("currencies", "1");  XmlSerializer ser = new XmlSerializer(typeof(prestashop));  objpresta = (prestashop)ser.Deserialize(strumien);  strumien.Close();    

When I run the code, object objpresta is null after deserializing but there is no error.

I would be very thankful for any help.

No comments:

Post a Comment