1
我有一個Customer類和一個相關的xml文件。以字符串的形式將XMl傳遞給Jaxb Unmarshaller
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方法?
非常感謝,這很有用。 – Pawan 2013-03-01 12:29:00