public JKeeperXML2JTree(Document document) {
        treeModel = new JKeeperTreeModel();
        
        Node root = document.getDocumentElement();
        int whattoshow = NodeFilter.SHOW_ALL;
        NodeFilter nodefilter = null;
        boolean expandreferences = false;

        DocumentTraversal traversal = (DocumentTraversal)document;
        TreeWalker walker = traversal.createTreeWalker(root, 
                                                       whattoshow, 
                                                       nodefilter, 
                                                       expandreferences);
        Node thisNode = null;
        thisNode = walker.nextNode();
        DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
        while (thisNode != null) {
            if (thisNode.getNodeName().equals("category")) {
                Element element = (Element)thisNode;
                //System.out.println("Category " + element.getAttribute("name"));
                DefaultMutableTreeNode newCategoryNode =
                        new DefaultMutableTreeNode(new JKeeperCategory(element.getAttribute("name")));
                rootNode.add(newCategoryNode);
                Node item = walker.firstChild();
                if (item != null) {
                    while (true) {
                        Element itemElement = (Element)item;
                        //System.out.println("Item " + itemElement.getAttribute("name"));
                        Node url = walker.firstChild();
                        Node username = walker.nextSibling();
                        Node password = walker.nextSibling();
                        Node notes = walker.nextSibling();
                        JKeeperItem newItem =
                                new JKeeperItem(itemElement.getAttribute("name"),
                                    url.getTextContent(), username.getTextContent(),
                                    password.getTextContent(), notes.getTextContent());
                        DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(newItem);
                        newCategoryNode.add(newNode);
                        item = walker.nextNode();
                        if (item != null && item.getNodeType() == Node.TEXT_NODE) {
                            item = walker.nextNode();
                        }
                        if (item == null || !item.getNodeName().equals("item")) {
                            walker.previousNode();
                            break;
                        }
                    }
                }
            }
            thisNode = walker.nextNode();
        }
    }