我有一个 Customer 类和一个相关的 xml 文件。
File file = new File("D:\\TestingData\\customer.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
Customer data = (Customer) jaxbUnmarshaller.unmarshal(file);
我需要将 customer.xml 文件放在外部位置。(D:\TestingData\customer.xml)
我的问题是我可以将 xml 文件作为字符串的一部分提供给 unmarshall 方法吗?