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

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

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

Parser.setNodeFactory介绍

[英]Set the current node factory.
[中]设置当前节点工厂。

代码示例

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Construct a parser using the provided lexer and feedback object.
 * This would be used to create a parser for special cases where the
 * normal creation of a lexer on a URLConnection needs to be customized.
 * @param lexer The lexer to draw characters from.
 * @param fb The object to use when information,
 * warning and error messages are produced. If <em>null</em> no feedback
 * is provided.
 */
public Parser (Lexer lexer, ParserFeedback fb)
{
  setFeedback (fb);
  if (null == lexer)
    throw new IllegalArgumentException ("lexer cannot be null");
  setLexer (lexer);
  setNodeFactory (new PrototypicalNodeFactory ());
}

代码示例来源:origin: org.htmlparser/htmlparser

/**
 * Construct a parser using the provided lexer and feedback object.
 * This would be used to create a parser for special cases where the
 * normal creation of a lexer on a URLConnection needs to be customized.
 * @param lexer The lexer to draw characters from.
 * @param fb The object to use when information,
 * warning and error messages are produced. If <em>null</em> no feedback
 * is provided.
 */
public Parser (Lexer lexer, ParserFeedback fb)
{
  setFeedback (fb);
  setLexer (lexer);
  setNodeFactory (new PrototypicalNodeFactory ());
}

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

Parser parser = Parser.createParser(result, "UTF-8");
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, false, overrideDocumentType);
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, true);

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

parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, false, overrideDocumentType);
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, true);

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

parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, false, overrideDocumentType);
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, true);

代码示例来源:origin: org.htmlparser/htmlparser

/**
 * Creates a Parser object with the location of the resource (URL or file)
 * You would typically create a DefaultHTMLParserFeedback object and pass
 * it in.
 * @see #Parser(URLConnection,ParserFeedback)
 * @param resource Either a URL, a filename or a string of HTML.
 * The string is considered HTML if the first non-whitespace character
 * is a &lt;. The use of a url or file is autodetected by first attempting
 * to open the resource as a URL, if that fails it is assumed to be a file
 * name.
 * A standard HTTP GET is performed to read the content of the URL.
 * @param feedback The HTMLParserFeedback object to use when information,
 * warning and error messages are produced. If <em>null</em> no feedback
 * is provided.
 * @throws ParserException If the URL is invalid.
 */
public Parser (String resource, ParserFeedback feedback)
  throws
    ParserException
{
  setFeedback (feedback);
  setResource (resource);
  setNodeFactory (new PrototypicalNodeFactory ());
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Create a web site capturer.
 */
public SiteCapturer ()
{
  PrototypicalNodeFactory factory;
  mSource = null;
  mTarget = null;
  mPages = new ArrayList ();
  mFinished = new HashSet ();
  mImages = new ArrayList ();
  mCopied = new HashSet ();
  mParser = new Parser ();
  factory = new PrototypicalNodeFactory ();
  factory.registerTag (new LocalLinkTag ());
  factory.registerTag (new LocalFrameTag ());
  factory.registerTag (new LocalBaseHrefTag ());
  factory.registerTag (new LocalImageTag ());
  mParser.setNodeFactory (factory);
  mCaptureResources = true;
  mFilter = null;
}

代码示例来源:origin: org.opencms/org.opencms.workplace.tools.content

parser.setNodeFactory(m_nodeFactory);
Lexer lexer = new Lexer();
Page page = new Page(html, encoding);

代码示例来源:origin: org.opencms/opencms-core

parser.setNodeFactory(m_nodeFactory);
Lexer lexer = new Lexer();
Page page = new Page(content);

代码示例来源:origin: org.opencms/opencms-solr

parser.setNodeFactory(m_nodeFactory);
Lexer lexer = new Lexer();
Page page = new Page(content);

相关文章