I have some problem when trying to deserialize the following XML:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Response xmlns=\"http://Microsoft.LobServices.Sap/2007/03/Rfc/\">
<E_ARR>
<ITEM xmlns=\"http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/\">
<PROPA>00100000</PROPA>
<PROPB>0815</PROPB>
</ITEM>
<ITEM xmlns=\"http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/\">
<PROPA>00100001</PROPA>
<PROPB>0123</PROPB>
</ITEM>
</E_ARR>
</Response>
Using the following lines of code:
var reader = new StringReader(XmlShownAbove);
var serializer = new XmlSerializer(typeof(Response));
var instance = (Response)serializer.Deserialize(reader);
And the following two models:
[XmlRoot("Response", Namespace="http://Microsoft.LobServices.Sap/2007/03/Rfc/")]
public class Response
{
[XmlArray("E_ARR", Namespace="")]
[XmlArrayItem(typeof(ITEM), ElementName = "ITEM", Namespace="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/")]
public ITEM[] E_ARR{ get; set; }
}
public class ITEM
{
[XmlElement(Namespace = "")]
public string PROPA{ get; set; }
[XmlElement(Namespace = "")]
public string PROPB{ get; set; }
}
Unfortunately this code does not deserialize the E_ARR
-Array correctly - it allways remains null
and I can't figure out why. I guess it is something simple but I just failed to see it - thanks in advance!