I have been trying to search an XML File. I have tried several methods but I can't get it to populate the nodes. Here is an example of the code I've tried.
XmlDocument document = new XmlDocument();
document.Load(filename.xml);
XmlNodeList nodes = document.DocumentElement.SelectNodes("/reports/metadata]");
foreach (XmlNode node in nodes)
{
// Show Search results
}
document.Load(filename.xml);
XmlNodeList nodes = document.DocumentElement.SelectNodes("/reports/metadata]");
foreach (XmlNode node in nodes)
{
// Show Search results
}
Here is a sample file I'm trying to parse.

VulpesRank #55 · 29.2K reputationPosted Feb 11, 2014, 2:00 PM EST
Anyway, try this LINQ to XML code:
The output is:
This code, of course, only gets the metadata nodes which are children of the reports node - it doesn't get those nodes which are children of the files or file nodes.
Stephen Miller5 reputationPosted Feb 11, 2014, 8:15 PM EST