这是我要运行的代码,但当前在此行引发异常:
try {
File file = new File(getFilesDir().getPath() + "/" + name + ".xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Restaurant.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(r, file);
} catch (JAXBException e) {
e.printStackTrace();
}
我在此行引发异常:
JAXBContext jaxbContext = JAXBContext.newInstance(Restaurant.class);
我将日志复制到pastebin(https://pastebin.com/WRjXbub7)
我正在尝试将对象序列化为XML文件。我的代码中没有出现红色标记或任何东西,所以我不知道问题出在哪里。谢谢!