title: Simple XML comparison
body: <p>I have a question regarding to a simple comparison between the innerxml of a node. I have write the following simple example, but this is not working by <strong>Innerxml</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Xml;
  
  
  namespace CompareXML
  {
  class Program
  {
      static void Main(string[] args)
      {
          string s1 = @"&lt;Deals&gt;
               &lt;Deal id='20504'&gt; 
               &lt;Marketarea&gt;H&lt;/Marketarea&gt;
               &lt;price&gt;22&lt;/price&gt;
               &lt;/Deal&gt;
               &lt;Deal id='20505'&gt; 
               &lt;Marketarea&gt;K&lt;/Marketarea&gt;
               &lt;price&gt;22&lt;/price&gt;
               &lt;/Deal&gt;  
              &lt;/Deals&gt;";
          string s2 = @"&lt;Deals&gt;
               &lt;Deal id='20504'&gt; 
               &lt;Marketarea&gt;S&lt;/Marketarea&gt;
               &lt;price&gt;&lt;/price&gt;
               &lt;/Deal&gt;  
              &lt;/Deals&gt;";
          XmlDocument d1 = new XmlDocument();
          XmlDocument d2 = new XmlDocument();
          d1.LoadXml(s1);
          d2.LoadXml(s2);
  
          int id = 20504;
          var text1 = d1.SelectSingleNode("Deal[@id='"+id+"']").InnerXml;
          var text2 = d2.SelectSingleNode("Deal[@id='" + id + "']").InnerXml;
          if (text1 == text2)
              Console.WriteLine("match");
          else
              Console.WriteLine("No match");
  
          Console.ReadKey();
      }
  
     }
  }
  </code></pre>
  
  <p>I cannot understand why when i have a node with attribute the Innerxml doesn't work and when i have just a simple node without attribute for example the node <code>&lt;Deal&gt;</code> works. </p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>ERROR</strong></p>
  
  <p><img src="https://i.stack.imgur.com/XhtmP.jpg" alt="enter image description here"></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So i would like from this example to take in the var text the following</p>
  
  <pre><code>     &lt;Marketarea&gt;H&lt;/Marketarea&gt;
       &lt;price&gt;22&lt;/price&gt;
  </code></pre>
  
  <p>and then to compare.</p>