List of usage examples for org.springframework.util.xml DomUtils createContentHandler
public static ContentHandler createContentHandler(Node node)
From source file:fi.uta.infim.usaproxylogparser.UsaProxyHTTPTrafficLogParser.java
/** * Parses an http traffic log for HTML content. * @param traffic the traffic session whose log is to be parsed * @return Root document node/*from w w w. ja v a2 s. c o m*/ * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ Document parseLog(UsaProxyHTTPTraffic traffic) throws ParserConfigurationException, IOException, SAXException { Parser p = new Parser(); // to define the html: prefix (off by default) p.setFeature("http://xml.org/sax/features/namespace-prefixes", true); Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); p.setContentHandler(DomUtils.createContentHandler(doc)); p.parse(new InputSource(getSeekedLogReader(traffic))); return doc; }