【发布时间】:2019-02-18 17:07:05
【问题描述】:
我有这样的xml
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<products>
<product>...</product>
<product>...</product>
</products>
</prestashop>
我想反序列化为 List<Product> 的对象
但我一直在尝试它根本不起作用
这是我的 Restsharp 代码
var client = new RestClient(baseUrl);
client.Authenticator = new HttpBasicAuthenticator(apiKey, null);
client.AddHandler("application/xml", new XmlAttributeDeserializer());
var request = new RestRequest("products", Method.GET);
request.AddParameter("display", "full");
request.AddParameter("limit", "2");
IRestResponse<ListProduct> response = client.Execute<ListProduct>(request);
var data = response.Data;
我做得对吗? 感谢您的帮助
【问题讨论】:
标签: xml deserialization restsharp