org.htmlparser.Parser.createParser()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.htmlparser.Parser.createParser()方法的一些代码示例,展示了Parser.createParser()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.createParser()方法的具体详情如下:
包路径:org.htmlparser.Parser
类名称:Parser
方法名:createParser

Parser.createParser介绍

[英]Creates the parser on an input string.
[中]在输入字符串上创建解析器。

代码示例

代码示例来源:origin: com.rogiel.httpchannel/httpchannel-util

public static HTMLPage parse(String html) {
    try {
      return new HTMLPage(Parser.createParser(html, null));
    } catch (ParserException e) {
      return null;
    }
  }
}

代码示例来源:origin: xuyisheng/TextViewForFullHtml

public static String parseFontHTML(String content) {
  hasData = false;
  Parser parser = Parser.createParser(content, "UTF-8");
  StringBuilder sb = null;
  try {
    NodeList list = (NodeList) parser.parse(null);
    if (hasFont(list)) {
      sb = getNewHtml(list);
    }
  } catch (ParserException e) {
    e.printStackTrace();
  }
  if (sb == null) {
    return content;
  }
  return sb.toString().replace("</FONT></FONT></FONT>", "</FONT>").replace("</FONT></FONT>", "</FONT>");
}

代码示例来源:origin: oaqa/knn4qa

public PostCleaner(String html, int minCodeChars, boolean excludeCode) {
 try {
  Parser htmlParser = Parser.createParser(html, "utf8");  

  PostCleanerVisitor res = new PostCleanerVisitor(minCodeChars, excludeCode);      
  htmlParser.visitAllNodesWith(res);      
  mText = res.getText();
 } catch (ParserException e) {      
  System.err.println(" Parser exception: " + e + " trying simple conversion");
  // Plan B!!!
  mText = PostCleanerVisitor.simpleProc(html);
 }    
}

代码示例来源:origin: deas/alfresco

Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);

代码示例来源:origin: org.alfresco.surf/spring-webscripts

Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);

代码示例来源:origin: org.exoplatform.core/exo.core.component.document

Parser parser = Parser.createParser(html, null);
StringBean sb = new StringBean();

代码示例来源:origin: org.springframework.extensions.surf/spring-webscripts

Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);

代码示例来源:origin: dbiir/rainbow

log.error("Get html error:", e);
Parser parser = Parser.createParser(html, "utf-8");//spark web ui用的是utf-8编码
HtmlPage page = new HtmlPage(parser);
try {

代码示例来源:origin: dbiir/rainbow

log.error("Get html error:", e);
Parser parser = Parser.createParser(html, "utf-8");//spark web ui用的是utf-8编码
HtmlPage page = new HtmlPage(parser);
try {

代码示例来源:origin: dbiir/rainbow

log.error("Get html error:", e);
Parser parser = Parser.createParser(html, "utf-8");//spark web ui用的是utf-8编码
HtmlPage page = new HtmlPage(parser);
try {

代码示例来源:origin: dhis2/dhis2-core

Parser parser = Parser.createParser( html, "UTF-8" );

相关文章