public static void save(){
        JAXBContext context;
        try {
            context = JAXBContext.newInstance(HierarchyType.class);
            Marshaller m = context.createMarshaller();
            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

    // Write to System.out
            m.marshal(rootElement, new File(pathname));
        } catch (JAXBException ex) {
            Logger.getLogger(Test4.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }