DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = builderFactory.newDocumentBuilder();
document = builder.parse(is);
} else if (contentType.matches("text/html.*")) {
DOMHandler domHandler = new DOMHandler();
Parser parser = new Parser();
parser.setContentHandler(domHandler);
parser.parse(new InputSource(is));
document = domHandler.getDocument();
}
if (document != null) {
document.getDocumentElement().normalize();
rootElement = document.getDocumentElement();
TreeModel tm = new DOMTreeModel(rootElement);