/** Utility method to serialize an exception and its stack trace to simple HTML. */
 private final void serializeException(PrintWriter osw, Throwable t) {
   osw.write("<b>Exception</b>: " + t.toString() + "\n<br/><br/>");
   osw.write("<b>Stack trace:</b>");
   osw.write(
       "<pre style=\"margin: 1px solid red; padding: 3px; font-family: sans-serif; font-size: small;\">");
   t.printStackTrace(osw);
   osw.write("</pre>");
 }
  public static void main(String[] args) throws IOException {
    String filename = "z.xml"; // NOT LOCALIZABLE, main

    try {
      String uri = "file:" + new File(filename).getAbsolutePath(); // NOT LOCALIZABLE, main

      //
      // turn it into an in-memory object.
      //
      Parser parser = getParser();
      parser.setDocumentHandler(new XmlParser());
      parser.setErrorHandler(new MyErrorHandler());
      parser.parse(uri);

    } catch (SAXParseException err) {
      Debug.trace(
          "** Parsing error" // NOT LOCALIZABLE, main
              + ", line "
              + err.getLineNumber() // NOT LOCALIZABLE
              + ", uri "
              + err.getSystemId()); // NOT LOCALIZABLE
      Debug.trace("   " + err.getMessage());

    } catch (SAXException e) {
      Exception x = e;
      if (e.getException() != null) x = e.getException();
      x.printStackTrace();

    } catch (Throwable t) {
      t.printStackTrace();
    }

    byte[] buf = new byte[256];
    Debug.trace("Press ENTER to exit."); // NOT LOCALIZABLE
    System.in.read(buf, 0, 256);
    System.exit(0);
  }