import org.ops4j.pax.carrot.api.ParserService; import org.ops4j.pax.carrot.api.ScannerService; import org.ops4j.pax.carrot.api.TemplateService; import org.ops4j.pax.carrot.runner.cli.Runner; public class HTMLParserExample { public static void main(String[] args) { String html = "<html><body><h1>Hello, OPS4J Pax Carrot!</h1></body></html>"; Runner runner = new Runner(); ParserService parserService = new ParserService(); ScannerService scannerService = new ScannerService(); TemplateService templateService = new TemplateService(); parserService.registerParser("html", new HtmlParser()); scannerService.registerScanner("html", new HtmlScanner()); templateService.registerTemplateEngine("velocity", new VelocityTemplateEngine()); runner.setParserService(parserService); runner.setScannerService(scannerService); runner.setTemplateService(templateService); runner.process(html); } }


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