title: <ClassName xmlns='http://uri'> was not expected
body: <p>I just generated a class using the xsd.exe (See <a href="https://stackoverflow.com/questions/5183550/design-strongly-typed-object-from-xml">previous question</a>) and then I tried to use it to deserialize my XML file.</p>
  
  <p>My XML files start like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?xml-stylesheet type='text/xsl' href='STIG_unclass.xsl'?&gt;
  &lt;Benchmark xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cpe="http://cpe.mitre.org/language/2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" id="Windows_2003" xml:lang="en" xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1 http://nvd.nist.gov/schema/xccdf-1.1.4.xsd http://cpe.mitre.org/dictionary/2.0 http://cpe.mitre.org/files/cpe-dictionary_2.1.xsd" xmlns="http://checklists.nist.gov/xccdf/1.1"&gt;
  </code></pre>
  
  <p>and the generated class from xsd.exe starts off like this:</p>
  
  <pre><code>    /// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://checklists.nist.gov/xccdf/1.1")]
  [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://checklists.nist.gov/xccdf/1.1", IsNullable = false)]
  public partial class Benchmark
  </code></pre>
  
  <p>but when I try and deserialize my XML file, using the following code:</p>
  
  <pre><code>var groups = new List&lt;Benchmark&gt;();
  XmlSerializer serializer = new XmlSerializer(typeof(List&lt;Benchmark&gt;));
  using (TextReader textReader = new StreamReader(open.FileName))
      groups = (List&lt;Benchmark&gt;)serializer.Deserialize(textReader);  // ERROR HERE
  
  SetGroups(groups);
  </code></pre>
  
  <p>I get an error message that says "There is an error in XML document (3, 2)." with an inner exception that says: "http://checklists.nist.gov/xccdf/1.1'> was not expected."</p>
  
  <p>What am I doing wrong?</p>