/// <summary> /// Main application entry point. /// </summary> /// <param name="args"></param> public static void Main(params string[] args) { Console.WriteLine("************************************" + "************************************"); Console.WriteLine("* Testing SAX2"); Console.WriteLine("************************************" + "************************************"); Console.Write("\n"); IXmlReader reader = XmlReaderFactory.Current.CreateXmlReader(); Console.WriteLine("XMLReader created successfully\n"); // // Check features. // Console.WriteLine("Checking defaults for some well-known features:"); checkFeature(reader, "http://xml.org/sax/features/namespaces"); checkFeature(reader, "http://xml.org/sax/features/namespace-prefixes"); checkFeature(reader, "http://xml.org/sax/features/string-interning"); checkFeature(reader, "http://xml.org/sax/features/validation"); checkFeature(reader, "http://xml.org/sax/features/external-general-entities"); checkFeature(reader, "http://xml.org/sax/features/external-parameter-entities"); Console.Write("\n"); // // Assign handlers. // Console.WriteLine("Creating and assigning handlers\n"); var handler = new SAXTest(); reader.ContentHandler = handler; reader.ErrorHandler = handler; // // Parse documents. // if (args.Length > 0) { foreach (string arg in args) { String systemId = makeAbsoluteURL(arg); Console.WriteLine("Trying file " + systemId); try { reader.Parse(systemId); } catch (SAXException e1) { Console.WriteLine(systemId + " failed with XML error: " + e1.Message); } catch (IOException e2) { Console.WriteLine(systemId + " failed with I/O error: " + e2.Message); } Console.Write("\n"); } } else { Console.WriteLine("No documents supplied on command line; " + "parsing skipped."); } // // Done. // Console.WriteLine("SAX2 test finished."); }