Created
March 25, 2015 18:01
-
-
Save Microsofttechies/994b3b58aecb41fece69 to your computer and use it in GitHub Desktop.
XML read all elements using C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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