title: XML Deserialization without a namespace
body: <p>I'm having a bit of trouble deserializing an XML that doesn't have a namespace. The odd thing is that I'm getting an exception saying "There is an error in XML document (2,2)."; Inner Exception "command_strings xmlns = was not expected.". I'm coding in VS2008.</p>
  
  <p>My XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;command_strings version="1"&gt;
      &lt;commands&gt;
           &lt;command cmd_id="1" state_id="1" label="On" cmd_type="F" cmd_string="1" /&gt;
      &lt;/commands&gt;
  &lt;/command_strings&gt;
  </code></pre>
  
  <p>My class</p>
  
  <pre><code>public class Command
  {
      [System.Xml.Serialization.XmlAttribute("cmd_id")]
      public int cmd_id { get; set; }
  
      [System.Xml.Serialization.XmlAttribute("state_id")]
      public int state_id { get; set; }
  
      [System.Xml.Serialization.XmlAttribute("label")]
      public string label { get; set; }
  
      [System.Xml.Serialization.XmlAttribute("cmd_type")]
      public string cmd_type { get; set; }
  
      [System.Xml.Serialization.XmlAttribute("cmd_string")]
      public string cmd_string { get; set; }
  }
  
  [System.Xml.Serialization.XmlRoot("commands_strings")]
  public class CommandCollection
  {
      [System.Xml.Serialization.XmlAttribute("version")]
      public int version { get; set; }
  
      [XmlArray("commands")]
      [XmlArrayItem("command", typeof(Command))]
      public Command[] Command { get; set; }
  }
  
  public bool IsValidXML()
  {
      CommandCollection commandscollection = null;
      XmlSerializer dserial = new XmlSerializer(typeof(CommandCollection));
  
      using (StreamReader streamReader = new StreamReader(@"C:\123.xml"))
      {
          commandscollection = (CommandCollection)dserial.Deserialize(streamReader);
          streamReader.Close();
      }
  }
  </code></pre>