title: Deserializing an XML document with the root being a list
body: <p>I have an XML document provided to me externally that I need to import into my application. The document is badly written, but not something I can really do much about.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &lt;xml&gt;
      &lt;Items&gt;
          &lt;Property1 /&gt;
          &lt;Property2 /&gt;
          ...
      &lt;/Items&gt;
      &lt;Items&gt;
          &lt;Property1 /&gt;
          &lt;Property2 /&gt;
          ...
      &lt;/Items&gt;
      ...
  &lt;/xml&gt;
  </code></pre>
  
  <p>How should I go about using the <code>XmlSerializer</code> for this?
  It doesn't seem to matter what class setup I use, or wether I put <code>XmlRoot(ElementName="xml")</code> on my base class it always says that the <code>&lt;xml xmlns=''&gt;</code> is unexpected.</p>
  
  <p><strong>Edit: Added the C# code I am using</strong></p>
  
  <pre><code>[XmlRoot(ElementName = "xml")]
  public class Container
  {
      public List&lt;Items&gt; Items { get; set; }
  }
  
  public class Items
  {
      public short S1 { get; set; }
      public short S2 { get; set; }
      public short S3 { get; set; }
      public short S4 { get; set; }
      public short S5 { get; set; }
      public short S6 { get; set; }
      public short S7 { get; set; }
  }
  
  public class XMLImport
  {
      public Container Data{ get; private set; }
  
      public static XMLImport DeSerializeFromFile(string fileName)
      {
          XMLImport import = new XMLImport();
          XmlSerializer serializer = new XmlSerializer(typeof(Container));
          using (StreamReader reader = new StreamReader(fileName))
              import.Data = (Container)serializer.Deserialize(reader);
          return import;
      }
  }
  </code></pre>