Here is the Xml I got from a website:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="[url]">
<totalResults>1</totalResults>
<movie code="134539" />
<movie code="134540" />
</feed>
My C# classes :
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
[Serializable]
[XmlRoot("feed", Namespace = "[url]")]
public class FeedSearch
{
[XmlElement("totalResults")]
public int TotalResults
{ get; set; }
[XmlArray("feed")]
[XmlArrayItem("movie")]
public List<MovieSearch> Movies
{ get; set; }
}
using System;
using System.Xml.Serialization;
[Serializable]
[XmlRoot("movie", Namespace = "[url]")]
public class MovieSearch
{
[XmlAttribute("code")]
public int Code
{ get; set; }
}
The TotalResults is always well deserialized but my Movies list is always empty, why?
Instead of:
Try like this: