title: Reading specific text from XML files
body: <p>I have created a small XML tool which gives me count of specific XML tags from multiple XML files. </p>
  
  <p>The code for this is as follow:</p>
  
  <pre><code>public void SearchMultipleTags()
          {
              if (txtSearchTag.Text != "")
              {
                  try
                  {
                      //string str = null;
                      //XmlNodeList nodelist;
                      string folderPath = textBox2.Text;
                      DirectoryInfo di = new DirectoryInfo(folderPath);
                      FileInfo[] rgFiles = di.GetFiles("*.xml");
                      foreach (FileInfo fi in rgFiles)
                      {
                          int i = 0;
                          XmlDocument xmldoc = new XmlDocument();
                          xmldoc.Load(fi.FullName);
                          //rtbox2.Text = fi.FullName.ToString();
  
                          foreach (XmlNode node in xmldoc.GetElementsByTagName(txtSearchTag.Text))
                          {
  
                              i = i + 1;
  
                              //
                          }
                          if (i &gt; 0)
                          {
                              rtbox2.Text += DateTime.Now + "\n" + fi.FullName + " \nInstance: " + i.ToString() + "\n\n";
  
                          }
                          else 
                          {
                              //MessageBox.Show("No Markup Found.");
                          }
  
                          //rtbox2.Text += fi.FullName + "instances: " + str.ToString();
                      }
  
                  }
                  catch (Exception)
                  {
  
                      MessageBox.Show("Invalid Path or Empty File name field.");
  
  
                  }
              }
              else
              {
                  MessageBox.Show("Dont leave field blanks.");
              }
  
          }
  </code></pre>
  
  <p>This code returns me the tag counts in Multiple XML files which user wants.</p>
  
  <p>Now the same I want to Search for particular text and its count present in XML files.</p>
  
  <p>Can you suggest the code using XML classes.</p>
  
  <p>Thanks and Regards,
  Mayur Alaspure </p>