title: printing list of xml nodes in c#
body: <p>I am need bit of help on getting list of xml nodes and printing them.</p>
  
  <p>My code is as below:</p>
  
  <pre><code>        XmlDocument doc = new XmlDocument();
          doc.Load("To44532.xml");
          XmlNode xn = doc.DocumentElement;
          foreach (XmlNode xn2 in xn)
          { Console.WriteLine(xn2); }
          Console.ReadLine();
  </code></pre>
  
  <p>I am new to c# please accept my apologies in advance for asking this basic question. So I wanted full list of nodes and then printing them in output.</p>
  
  <p>I ended up with this piece of code because I wanted to debug one of the other code. The idea was that I wanted to display specific nodes in winforms. I tried if statement e.g. :</p>
  
  <pre><code>        foreach (XmlNode node in doc.DocumentElement)
          {
              if (node.Equals("DbtItm"))
              { ..... }
  </code></pre>
  
  <p>Could you please advise whats the best way to achieve it?</p>