Answers for "jaxb unmarshal1 count of illegal annotations"

0

jaxb unmarshal1 count of illegal annotations

import java.io.File;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class TestMain {

    public static void main(String[] args) {

        String xmlPath = "C:\\" + File.separator  + "customer.xml";

        try {

            File file = new File(xmlPath);

            JAXBContext jaxbContext = JAXBContext.newInstance(new Class[] {Company.class,Address.class,Costumer.class});
            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            Company customer = (Company) jaxbUnmarshaller.unmarshal(file);
            System.out.println(customer);

          } catch (JAXBException e) {
            e.printStackTrace();
          }
    }
}
Posted by: Guest on September-06-2021

Code answers related to "jaxb unmarshal1 count of illegal annotations"

Browse Popular Code Answers by Language