title: Handling extra spaces when deserializing XML values to enums
body: <p>I've been wondering if it's possible to do this.</p>
  
  <p>It would be a great help in cases where an XML response has incorrect values that are needing to be mapped to enums.</p>
  
  <p>The case I'm dealing with specifically is when an expected value has a trailing space and the enum is expecting it without.</p>
  
  <h3>XML:</h3>
  
  <pre><code>&lt;Foo&gt;
      &lt;Bar&gt;EnumValue &lt;/Bar&gt;
  &lt;/Foo&gt;
  </code></pre>
  
  <h3>Enum:</h3>
  
  <pre><code>public enum MyEnum
  {
      [XmlEnum("EnumValue")]
      EnumValue
  }
  </code></pre>
  
  <h3>Class:</h3>
  
  <pre><code>public class Foo
  {
      [XmlElement("Bar")]
      public MyEnum myEnum { get; set; }
  }
  </code></pre>
  
  <p>I've investigated using a custom attribute (instead of "XmlEnum") to trim the values but it doesn't seem to be reached during the deserialization.</p>
  
  <p>Is there a way to trim XML values (when needed) before/during deserialization so that the value can be mapped to the enum correctly?</p>
  
  <p>-</p>
  
  <p>I should add that I <i>can't</i> make any changes to how the XML is sent, I can only deal with the response.</p>
  
  <p>Also, simply changing the attribute parameter to [XmlEnum("EnumValue ")] fixes the issue, but this is not satisfactory as the XML value could be altered at a later date.</p>