expandAll(xmlTree, true);
    public void setBytes(String contentType, byte[] bytes) {        _data = bytes;        if (bytes != null) {            InputStream is = new ByteArrayInputStream(bytes);            Element rootElement = null;            try {                Document document = null;                if (contentType.matches("text/xml.*")) {                    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);                    xmlTree.setModel(tm);                } else {                    xmlTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Invalid content")));                }            } catch (Exception e) {                xmlTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Error: " + e.getMessage())));                e.printStackTrace();            }        } else {            xmlTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("No elements")));        }    }