title: Compare two XmlNodes in C#
body: <p>Is there a simple way to compare two XML structures to determine if they have the same structure and data?</p>
  
  <p>I have a function that returns an XmlNode and I am trying to write unit tests for it.  I store the correct XML result in a file.  Durring the test I load the file into an XmlDocument, locate the proper XmlNode and compare against the result of the function.  A straight compare does not work (as expected) and InnerXml does not work either.
  I am considering removing all whitespace from InnerXml and comparing that, or writing my own compare to walk the tree, but I don't like either option much.</p>