public static void GetXmlFromFile(string filePath, out XmlReader reader) { reader = null; //filepath can be uri with http or filesystem if (FileStorageIO.FileExists(filePath)) { //keep settings consistent with linq to xml default XmlReaderSettings oSettings = new XmlReaderSettings(); oSettings.ConformanceLevel = ConformanceLevel.Document; oSettings.IgnoreWhitespace = true; oSettings.IgnoreComments = true; reader = XmlReader.Create(filePath, oSettings); } }