Exception while unmarshalling an xml file using JAXB
843834Jan 20 2006 — edited May 11 2007Hi,
Am getting an exception below for my code which is triyng to unmarshall an XML file.
The type javax.xml.stream.XMLEventReader cannot be resolved. It is indirectly referenced from
required .class files
My code is as follows ...
import test.jaxb.PurchaseOrder;
import test.jaxb.Header;
import java.io.File;
import java.util.*;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
public class PurchaseOrderClient {
/**
* @param args
*/
public static void main(String[] args) {
try{
JAXBContext jc = JAXBContext.newInstance("test.jaxb");
Unmarshaller unmarshaller = jc.createUnmarshaller();
PurchaseOrder po = null;
po = (PurchaseOrder)unmarshaller.unmarshal(new File("PurchaseOrder.xml"));
Header h = po.getHeader();
System.out.println(h.buyerAddress());
System.out.println(h.buyerName());
}
catch(UnmarshallException e) {
}
catch(Exception e)
{
}
}
}
Any help is greatly appreciated.
Aditya.