@Override
  public Document build(final InputSource in)
    throws JDOMException, IOException {
    try {
      // Parse the document.
      saxParser.parse(in);

      return saxHandler.getDocument();
    }
    catch (final SAXParseException e) {
      Document doc = saxHandler.getDocument();
      if (!doc.hasRootElement()) {
        doc = null;
      }

      final String systemId = e.getSystemId();
      if (systemId != null) {
        throw new JDOMParseException("Error on line " +
                                     e.getLineNumber() + " of document " + systemId + ": " +
                                     e.getMessage(), e, doc);
      }
      throw new JDOMParseException("Error on line " +
                                   e.getLineNumber() + ": " +
                                   e.getMessage(), e, doc);
    }
    catch (final SAXException e) {
      throw new JDOMParseException("Error in building: " +
                                   e.getMessage(), e, saxHandler.getDocument());
    }
    finally {
      // Explicitly nullify the handler to encourage GC
      // It's a stack var so this shouldn't be necessary, but it
      // seems to help on some JVMs
      saxHandler.reset();
    }
  }
@Override
  public Document build(final InputSource in)