static void Main(string[] args) { if ( args.Length < 2) { Console.Error.WriteLine("Syntax: demo <path-to-xml-file> <xpath-expression> [<num-iterations(default={0})>]", numIters); return; } var file = args[0]; var xpath = args[1]; if ( args.Length > 2) { numIters = int.Parse(args[2]); } Console.WriteLine("Loading {0}", file); var proc = new Processor(); var ms_xp = System.Xml.XPath.XPathExpression.Compile(xpath); var xpc = proc.NewXPathCompiler(); var xpe = xpc.Compile(xpath); var sel = xpe.Load(); var doc = XDocument.Load(file); var ctx = proc.Wrap(doc); sel.ContextItem = ctx; var nt = new NameTable(); XmlDocument xd = new XmlDocument(nt); xd.Load(file); var ctxXmlDoc = proc.NewDocumentBuilder().Wrap(xd); Console.WriteLine("Evaluating {0}", xpath); Time(() => Saxon(sel), "XDoc (Saxon)"); Time(() => Native(ms_xp, doc), "XDoc (Native)"); sel.ContextItem = ctxXmlDoc; Time(() => Saxon(sel), "XmlDoc (Saxon)"); Time(() => Native(ms_xp, xd), "XmlDoc (Native)"); }