PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/testability-explorer/src/main/java/com/google/test/metric/report/XMLReportLoader.java

http://testability-explorer.googlecode.com/
Java | 25 lines | 16 code | 4 blank | 5 comment | 0 complexity | 1ee887bcd0feac0ea46b53244b72f181 MD5 | raw file
 1package com.google.test.metric.report;
 2
 3import java.io.IOException;
 4import java.io.Reader;
 5
 6import javax.xml.parsers.DocumentBuilder;
 7import javax.xml.parsers.DocumentBuilderFactory;
 8import javax.xml.parsers.ParserConfigurationException;
 9
10import org.w3c.dom.Document;
11import org.xml.sax.InputSource;
12import org.xml.sax.SAXException;
13
14/**
15 * Read an XML report into a DOM Document.
16 *
17 * @author alexeagle@google.com (Alex Eagle)
18 */
19public class XMLReportLoader {
20  public Document loadXML(Reader reader) throws ParserConfigurationException, IOException, SAXException {
21    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
22    DocumentBuilder documentBuilder = factory.newDocumentBuilder();
23    return documentBuilder.parse(new InputSource(reader));
24  }
25}