/** * Interactive inspection of an XML context. This function can be called anytime. Also, a * stand-alone utility program is provided to inspect XML documents. * * @param context the XML context */ public static void debug(Object context) { // Instanties a new XML debugger and executes it immediately // for the given file. XPathDebugger debugger = new XPathDebugger(); debugger.set_context(context); debugger.prompt(); } // debug()
/** * Executes the XPath debugger as a stand-alone program. * * @param args the command-line arguments */ public static void main(String[] args) { if (args.length == 0) { System.out.printf("No arguments\n"); System.exit(EXIT_SUCCESS); } // if try { XPathDebugger debugger = new XPathDebugger(); // May throw debugger.parse_arguments(args); // Execute debugger.prompt(); } catch (Exception ex) { ex.printStackTrace(); System.exit(EXIT_FAILURE); } // try-catch /* File file = new File(args[0]); Document doc = null; // Otherwise, attempt to load the file try { System.out.printf("Loading %s\n", file.getPath()); doc = XMLFileHelper.deserialize_document(file); } catch(Exception ex) { System.out.printf("Error: %s\n", ex.getMessage()); System.exit(EXIT_FAILURE); } // try-catch // Execute the debugger System.out.printf("Type \'quit\' or \'stop\' to exit.\n"); XPathDebugger.debug(doc); */ // Indicate succesful exit System.exit(EXIT_SUCCESS); } // main()