Xml Sequence deserialization with RestSharp

后端 未结 2 1276
面向向阳花
面向向阳花 2020-12-21 15:14

I have this xml feed from an API with a XML sequence.



    2002
             


        
2条回答
  •  我在风中等你
    2020-12-21 16:18

    Your XML doesn't match your object model. There are two simple ways of fixing it * Make your XML response actually contain a list structure * Write a custom parser. ** https://github.com/restsharp/RestSharp/wiki/Deserialization

    Who is responsible for generating the XML / Soap? Looks like something hand crafted.

    Look at the examples on the Restsharp page regarding the deserialisation of a list:

    
    
        
            value1
            value2
            value3
            value4
        
    
    

    Will map to the following C# schema:

    public class ListSample
    {
        public List Images { get; set; }
    }
    
    public class Image
    {
        public string Src { get; set; }
        public string Value { get; set; }
    }
    

提交回复
热议问题