<dependency> <groupId>org.ops4j.pax.carrot</groupId> <artifactId>pax-carrot-html</artifactId> <version>1.0.0</version> </dependency> CarrotEngine engine = new CarrotEngine(); engine.start(); HTMLParser parser = new HTMLParser(); HTMLDocument document = parser.parse(new File("example.html")); List<HTMLLink> links = document.getLinks(); for (HTMLLink link : links) { System.out.println(link.getHref()); } try { } catch (CarrotException e) { e.printStackTrace(); } CarrotConfiguration config = new CarrotConfiguration(); config.setOption(CarrotOptions.IGNORE_CASE, true); config.setOption(CarrotOptions.MAX_ERRORS, 100); config.setOption(CarrotOptions.USE_XHTML_MODE, false); CarrotEngine engine = new CarrotEngine(config);


上一篇:
下一篇:
切换中文