Last active
November 24, 2016 13:48
-
-
Save bertwagner/c56c0d1859449a9269e26d4bd7e0a26f to your computer and use it in GitHub Desktop.
Method for parsing XML using XmlReader
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
public static void XmlReaderTest(string filePath) | |
{ | |
// We create storage for ids of all of the rows from users where reputation == 1 | |
List<string> singleRepRowIds = new List<string>(); | |
using (XmlReader reader = XmlReader.Create(filePath)) | |
{ | |
while (reader.Read()) | |
{ | |
if (reader.IsStartElement()) | |
{ | |
if (reader.Name == "row" && reader.GetAttribute("Reputation") == "1") | |
{ | |
singleRepRowIds.Add(reader.GetAttribute("Id")); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment