public static void main(String[] args) throws JAXBException {

            Worker worker = new Worker();

        worker.setName("Sergii");

        worker.setAge(25);

        worker.setId(7);

        File file = new File("D:\\Java SE\\src\\xml\\jaxb\\worker.xml");

        JAXBContext jaxbContext = JAXBContext.newInstance(Worker.class);

        Marshaller marshaller = jaxbContext.createMarshaller();

        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        marshaller.marshal(worker, file);
        marshaller.marshal(worker, System.out);

        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

        Worker wprker = (Worker)unmarshaller.unmarshal(file);

        System.out.println(wprker.getName());
    }