1 22 23 package net.sourceforge.cobertura.reporting; 24 25 import java.io.File ; 26 import java.io.FileNotFoundException ; 27 import java.io.IOException ; 28 29 import org.jdom.Document; 30 import org.jdom.JDOMException; 31 import org.jdom.input.SAXBuilder; 32 33 public class JUnitXMLHelper 34 { 35 36 private final static String BASEDIR = (System.getProperty("basedir") != null) ? System 37 .getProperty("basedir") : "."; 38 39 50 public static Document readXmlFile(File file, boolean validate) throws FileNotFoundException , 51 IOException , JDOMException 52 { 53 System.out.println("Reading " + file.getAbsolutePath()); 54 55 SAXBuilder saxBuilder = new SAXBuilder(); 57 saxBuilder.setValidation(validate); 58 saxBuilder.setEntityResolver(new JUnitXMLParserEntityResolver( 59 new File (BASEDIR, "/etc/dtds"))); 60 saxBuilder.setErrorHandler(new JUnitXMLParserErrorHandler()); 61 return saxBuilder.build(file); 62 } 63 64 } 65 | Popular Tags |