// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Xml; namespace E { public class Program { private static void Test1() { try { XmlDocument doc = new XmlDocument(); doc.Load(new StreamReader(@"C:\Work\dirty.xml")); Console.WriteLine(doc.DocumentElement.Name); } catch(Exception ex) { Console.WriteLine("Exception as expected"); } } private static void Test2() { try { String xmlstr = File.ReadAllText(@"C:\Work\dirty.xml"); int validstart = xmlstr.IndexOf("