本文整理匯總了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;
}