本文整理汇总了Java中org.jsoup.parser.Parser.htmlParser方法的典型用法代码示例。如果您正苦于以下问题:Java Parser.htmlParser方法的具体用法?Java Parser.htmlParser怎么用?Java Parser.htmlParser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jsoup.parser.Parser
的用法示例。
在下文中一共展示了Parser.htmlParser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseHtmlTemplate
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
/**
* Parse a given HTML template and return the a result object containing the expressions
* and a transformed HTML.
* @param htmlTemplate The HTML template to process, as a String
* @param context Context of the Component we are currently processing
* @return A {@link TemplateParserResult} containing the processed template and expressions
*/
public TemplateParserResult parseHtmlTemplate(String htmlTemplate,
TemplateParserContext context)
{
this.context = context;
Parser parser = Parser.htmlParser();
parser.settings(new ParseSettings(true, true)); // tag, attribute preserve case
Document doc = parser.parseInput(htmlTemplate, "");
result = new TemplateParserResult();
processImports(doc);
processNode(doc);
result.setProcessedTemplate(doc.body().html());
return result;
}
示例2: parse
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
private static Document parse(String html) throws IOException {
Parser parser = Parser.htmlParser();
Document doc = Jsoup.parse(new ByteArrayInputStream(html.getBytes(UTF_8)), null, "", parser);
doc.outputSettings().indentAmount(0);
doc.outputSettings().prettyPrint(false);
return doc;
}
示例3: Request
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
private Request() {
timeoutMilliseconds = 3000;
maxBodySizeBytes = 1024 * 1024; // 1MB
followRedirects = true;
data = new ArrayList<Connection.KeyVal>();
method = Method.GET;
headers.put("Accept-Encoding", "gzip");
parser = Parser.htmlParser();
}
示例4: Request
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
private Request() {
timeoutMilliseconds = 3000;
maxBodySizeBytes = 1024 * 1024; // 1MB
followRedirects = true;
data = new ArrayList<Connection.KeyVal>();
method = Connection.Method.GET;
headers.put("Accept-Encoding", "gzip");
parser = Parser.htmlParser();
}
示例5: Request
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
Request() {
timeoutMilliseconds = 30000; // 30 seconds
maxBodySizeBytes = 1024 * 1024; // 1MB
followRedirects = true;
data = new ArrayList<>();
method = Method.GET;
addHeader("Accept-Encoding", "gzip");
addHeader(USER_AGENT, DEFAULT_UA);
parser = Parser.htmlParser();
}
示例6: run
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
private void run(Path path) throws IOException {
Parser parser = Parser.htmlParser();
try (InputStream input = Files.newInputStream(path)) {
Jsoup.parse(input, null, "", parser).traverse(this);
}
}
示例7: htmlParser
import org.jsoup.parser.Parser; //导入方法依赖的package包/类
/**
* change parser to htmlParser.
*
* @return
*/
public SelectorExtractor htmlParser() {
this.parser = Parser.htmlParser();
return this;
}