Need help resolving c# DataContract deserializing error
<p>I am trying to deserialze an XML document to a c# DataContract and encountering errors:</p>

<p>The error message is as:</p>

<blockquote>
  <p>Error in line 2 position 2. Expecting element 'Ernmxml' from namespace
  'http://ddex.net/xml/2010/ern-main/32'.. Encountered 'Element'  with
  name 'NewReleaseMessage', namespace
  'http://ddex.net/xml/2010/ern-main/32'</p>
</blockquote>

<p>I haven't completed the entire DataContract as yet but here is what I have so far:</p>

<pre><code>namespace DdexCoverter
{
    [DataContract]
    public class Ernmxml
    {

        [IgnoreDataMemberAttribute] public string NewReleaseMessage;
        [DataMember] public string PartId;

    }
}
</code></pre>

<p>Here is my Main program:</p>

<pre><code>   class Program
    {
        static void Main(string[] args)
        {
            FileStream xmlstream = File.OpenRead(ConfigurationManager.AppSettings["xmlfilepath"]);
            var xr = new XmlTextReader(ConfigurationManager.AppSettings["xmlfilepath"]);

            var ddexxml =  new Ernmxml();

            var dcs = new DataContractSerializer(typeof(Ernmxml));

            var ernmobj = (Ernmxml) dcs.ReadObject(xr);



        }
    }
}
</code></pre>

<p>The error is generated at this line:
var ernmobj = (Ernmxml) dcs.ReadObject(xr);</p>

<p>The XML beginning looks like:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ern:NewReleaseMessage xmlns:ern="http://ddex.net/xml/2010/ern-main/32"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       LanguageAndScriptCode="en"
                       xsi:schemaLocation="http://ddex.net/xml/2010/ern-main/32 http://ddex.net/xml/2010/ern-main/32/ern-main.xsd"
                       MessageSchemaVersionId="2010/ern-main/32"&gt;
  &lt;MessageHeader&gt;
    &lt;MessageThreadId&gt;PADPIDA&lt;/MessageThreadId&gt;
    &lt;MessageId&gt;PADPIDA&lt;/MessageId&gt;
    &lt;MessageSender&gt;
      &lt;PartyId&gt;PADPIDA&lt;/PartyId&gt;
      &lt;PartyName&gt;
</code></pre>

<p>Can someone please advice me how to resolve this error?</p>
