Skip to content

Instantly share code, notes, and snippets.

@Microsofttechies
Created March 25, 2015 18:01
Show Gist options
  • Select an option

  • Save Microsofttechies/994b3b58aecb41fece69 to your computer and use it in GitHub Desktop.

Select an option

Save Microsofttechies/994b3b58aecb41fece69 to your computer and use it in GitHub Desktop.
XML read all elements using C#
string strFilename = "Videos.xml";
XmlDocument xmlDoc = new XmlDocument();
if (File.Exists(strFilename))
{
XmlTextReader rdrXml = new XmlTextReader(strFilename);
do {
switch (rdrXml.NodeType)
{
case XmlNodeType.Element:
Console.WriteLine("{0}", rdrXml.Name);
break;
}
}while (rdrXml.Read());
}
else
Console.WriteLine("The file {0} could not be located",
strFilename);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment