/** * Parses mathml from the input into a DOM document. Split out so that subclass can call. * * @param params Parameters including MathML * @param result Blank result object * @param start Request start time (milliseconds since epoch) * @return Document or null if failed (in which case should return result) */ protected Document parseMathml(MathsImageParams params, MathsImageReturn result, long start) throws Exception { try { Document mathml = parseMathml(params.getMathml()); if (SHOWPERFORMANCE) { System.err.println("Parse DOM: " + (System.currentTimeMillis() - start)); } return mathml; } catch (SAXParseException e) { int line = e.getLineNumber(), col = e.getColumnNumber(); result.setError("MathML parse error at " + line + ":" + col + " - " + e.getMessage()); return null; } }