public HTMLParser(java.io.Writer out, String encoding, String configScriptTag, String pathInfo) { String projectPath = pathInfo.substring(pathInfo.indexOf(WS_WORKSPACE) + WS_WORKSPACE.length()); projectPath = projectPath.substring(0, projectPath.lastIndexOf('/')); int removeCount = projectPath.indexOf("WebContent") == -1 ? 1 : 2; int segCount = countSegments(projectPath) - removeCount; StringBuffer sb = new StringBuffer(); for (int i = 0; i < segCount; i++) { sb.append("../"); } sb.append("lib/zazl/zazl.js"); zazlPath = sb.toString(); this.encoding = encoding; this.configScriptTag = configScriptTag; parser = new HTMLConfiguration(); parser.setFeature(AUGMENTATIONS, true); XMLDocumentFilter[] filters = {this, new Identity(), new HTMLWriter(out, this.encoding)}; parser.setProperty(FILTERS, filters); }
public void parse(String html) throws IOException { parser.parse(new XMLInputSource(null, "", null, new StringReader(html), encoding)); }