1
在我的項目中,我通過JaxB
對象生成了xml文件。現在我再次想要解除對象現在的JAXB
對象。當我嘗試解組時拋出classcastException。無法解組xml文件
請找我寫的類:
public class ReservationTest1 {
public static void main(String []args) throws IOException, JAXBException
{
JAXBContext jaxbContext = JAXBContext.newInstance(com.hyatt.Jaxb.makeReservation.request.OTAHotelResRQ.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
@SuppressWarnings("unchecked")
JAXBElement bookingElement = (JAXBElement) unmarshaller.unmarshal(
new FileInputStream("D://myproject//Reservation.xml"));
System.out.println(bookingElement.getValue());
}
}
能否請您提供有用的信息來解決它。