public static boolean isWellFormedXML(InputSource html) {
		try {
			DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
			fact.setNamespaceAware(true);
			DocumentBuilder builder = fact.newDocumentBuilder();
			MYErrorHandler h = new MYErrorHandler();
			builder.setErrorHandler(h);
			builder.parse(html);
			return !h.hasErrors();
		} catch (SAXParseException e) {
			logger.errorf("line %,d; can't validate %s: %s", e.getLineNumber(), html, e);
			return false;
		} catch (SAXException e) {
			logger.errorf("can't validate " + html + ": ", e);
			return false;
		} catch (Exception e) {
			logger.errorf("can't validate " + html + ": ", e);
			return false;
		}
	}