public static void deleteNode(DefaultMutableTreeNode node) {
 
            if(getName(node.getUserObject()).equals("hierarchy")){
                node.setUserObject(null);
                return;
            }
            if(getName(node.getUserObject()).equals("hierarchydocs"))
            {
                /*HierarchyType parent=(HierarchyType)node.getParent();
                parent.setHierarchyDocs(null);*/
                return;
            }
            if(getName(node.getUserObject()).equals("hierarchyblocks"))
            {
                /*HierarchyType parent=(HierarchyType)node.getParent();
                parent.setHierarchyBlocks(null);*/
                return;
            }
 
            if(getName(node.getUserObject()).equals("document")){
                HierarchyDocsType parent=(HierarchyDocsType)((DefaultMutableTreeNode)node.getParent()).getUserObject();
                parent.getDocument().remove(node.getUserObject());         
                return;
            }
 
            if((getName(node.getUserObject()).equals("imageblock"))||
                    (getName(node.getUserObject()).equals("textblock"))||
                        (getName(node.getUserObject()).equals("composedblock")))
                    {
                DefaultMutableTreeNode parent= (DefaultMutableTreeNode) node.getParent();
                if(getName(parent.getUserObject()).equals("hierarchyblocks")){
                   HierarchyBlocksType block= (HierarchyBlocksType)parent.getUserObject(); 
                   block.getTextBlockOrImageBlockOrComposedBlock().remove(node.getUserObject());
                   return;
            }
                 if(getName(parent.getUserObject()).equals("composedblock")){
                   ComposedBlockType block= (ComposedBlockType)parent.getUserObject(); 
                   block.getTextBlockOrImageBlockOrComposedBlock().remove(node.getUserObject());
                   return;
            }
                 return;
            }
            if(getName(node.getUserObject()).equals("polygon")){
                ImageBlockType parent=(ImageBlockType)((DefaultMutableTreeNode)node.getParent()).getUserObject();
                parent.setPolygon(null);         
                return;
            }
            if(getName(node.getUserObject()).equals("point")){
                PolygonType parent=(PolygonType)((DefaultMutableTreeNode)node.getParent()).getUserObject();
                parent.getPoint().remove(node.getUserObject());        
                return;
            }
            if(getName(node.getUserObject()).equals("textline")){
                TextBlockType parent=(TextBlockType)((DefaultMutableTreeNode)node.getParent()).getUserObject();
                parent.getTextLine().remove(node.getUserObject());        
                return;
            }
            if(getName(node.getUserObject()).equals("string")){
                TextBlockType.TextLine parent=(TextBlockType.TextLine)((DefaultMutableTreeNode)node.getParent()).getUserObject();
                parent.getString().remove(node.getUserObject());        
                return;
            }
    }