title: Deserializing XML from String
body: <p>I'm trying to convert the result I get from my web service as a string and convert it to an object.</p>
  
  <p>This is the string I'm getting from my service:</p>
  
  <pre><code>&lt;StatusDocumentItem&gt;&lt;DataUrl/&gt;&lt;LastUpdated&gt;2013-01-31T15:28:13.2847259Z&lt;/LastUpdated&gt;&lt;Message&gt;The processing of this task has started&lt;/Message&gt;&lt;State&gt;1&lt;/State&gt;&lt;StateName&gt;Started&lt;/StateName&gt;&lt;/StatusDocumentItem&gt;
  </code></pre>
  
  <p>So I have a class for this as:</p>
  
  <pre><code>[XmlRoot]
  public class StatusDocumentItem
  {
      [XmlElement]
      public string DataUrl;
      [XmlElement]
      public string LastUpdated;
      [XmlElement]
      public string Message;
      [XmlElement]
      public int State;
      [XmlElement]
      public string StateName;
  }
  </code></pre>
  
  <p>And this is how I'm trying to get that string as an object of type StatusDocumentItem with XMLDeserializer (NB. operationXML contains the string):</p>
  
  <pre><code>string operationXML = webRequest.getJSON(args[1], args[2], pollURL);
  var serializer = new XmlSerializer(typeof(StatusDocumentItem));
  StatusDocumentItem result;
  
  using (TextReader reader = new StringReader(operationXML))
  {
      result = (StatusDocumentItem)serializer.Deserialize(reader);
  }
  
  Console.WriteLine(result.Message);
  </code></pre>
  
  <p>But my result object is always empty. What am I doing wrong?</p>
  
  <p><strong>Update</strong>. The value I get from my operationXML is like this and has an unnecessary xmlns attribute that is blocking my deserialization. Without that attribute, everything is working fine. Here is how it looks like:</p>
  
  <pre><code>"&lt;StatusDocumentItem xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"&gt;&lt;DataUrl/&gt;&lt;LastUpdated&gt;2013-02-01T12:35:29.9517061Z&lt;/LastUpdated&gt;&lt;Message&gt;Job put in queue&lt;/Message&gt;&lt;State&gt;0&lt;/State&gt;&lt;StateName&gt;Waiting to be processed&lt;/StateName&gt;&lt;/StatusDocumentItem&gt;"
  </code></pre>