package parserCodereview; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import parserCodereview.Error; import parserCodereview.ErrorList; public class ErrorMain { private static final String BOOKSTORE_XML = "C:\\Test_CodeReviewError2013-05-07_10-20-12.129.xml"; public static void main(String[] args) throws JAXBException, IOException { // create JAXB context JAXBContext context = JAXBContext.newInstance(ErrorList.class); // get variables from our xml file, created before System.out.println(); System.out.println("Output from our XML File: "); Unmarshaller um = context.createUnmarshaller(); ErrorList errorlist2 = (ErrorList) um.unmarshal(new FileReader(BOOKSTORE_XML)); ArrayList list = errorlist2.getErrorsList(); for (Error error : list) { System.out.println("Script: " + error.getName() + " /Severité: " + error.getSeverity() + " /Function: " + error.getFunction() + " /Message: " + error.getMessage()); } } }