本文整理了Java中org.htmlparser.Parser.extractAllNodesThatMatch()
方法的一些代码示例,展示了Parser.extractAllNodesThatMatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.extractAllNodesThatMatch()
方法的具体详情如下:
包路径:org.htmlparser.Parser
类名称:Parser
方法名:extractAllNodesThatMatch
[英]Extract all nodes matching the given filter.
[中]提取与给定过滤器匹配的所有节点。
代码示例来源:origin: stackoverflow.com
Parser parser = new Parser(url);
NodeList movies = parser.extractAllNodesThatMatch(
new AndFilter(new TagNameFilter("div"),
new HasAttributeFilter("class", "movie")));
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
/**
* Convenience method to extract all nodes of a given class type.
* Equivalent to
* <code>extractAllNodesThatMatch (new NodeClassFilter (nodeType))</code>.
* @param nodeType The class of the nodes to collect.
* @throws ParserException If a parse error occurs.
* @return A list of nodes which have the class specified.
* @deprecated Use extractAllNodesThatMatch (new NodeClassFilter (cls)).
* @see #extractAllNodesThatAre
*/
public Node [] extractAllNodesThatAre (Class nodeType)
throws
ParserException
{
NodeList ret;
ret = extractAllNodesThatMatch (new NodeClassFilter (nodeType));
return (ret.toNodeArray ());
}
代码示例来源:origin: stackoverflow.com
Parser parser = Parser.createParser(comment.getText(), "UTF-8");
NodeList htmlAnchorNodes = null;
try {
htmlAnchorNodes = parser
.extractAllNodesThatMatch(new TagNameFilter("a"));
} catch (ParserException e) {
e.printStackTrace();
}
int size = htmlAnchorNodes.size();
代码示例来源:origin: org.wso2.carbon.automationutils/org.wso2.carbon.integration.common.tests
public static List<String> getLinks(String url) throws ParserException {
Parser htmlParser = new Parser(url);
List<String> links = new LinkedList<String>();
NodeList tagNodeList = htmlParser.extractAllNodesThatMatch(new NodeClassFilter(LinkTag.class));
for (int m = 0; m < tagNodeList.size(); m++) {
LinkTag loopLinks = (LinkTag) tagNodeList.elementAt(m);
String linkName = loopLinks.getLink();
links.add(linkName);
}
return links;
}
代码示例来源:origin: stackoverflow.com
int size;
{
Parser parser = Parser.createParser(comment.getText(), "UTF-8");
NodeList htmlAnchorNodes = null;
try {
htmlAnchorNodes = parser
.extractAllNodesThatMatch(new TagNameFilter("a"));
} catch (ParserException e) {
e.printStackTrace();
}
size = htmlAnchorNodes.size();
}
代码示例来源:origin: org.htmlparser/htmlparser
try
list = mParser.extractAllNodesThatMatch (filter);
list = mParser.extractAllNodesThatMatch (filter);
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
try
list = mParser.extractAllNodesThatMatch (filter);
list = mParser.extractAllNodesThatMatch (filter);
代码示例来源:origin: eu.fbk.utils/utils-lsa
NodeList list = parser.extractAllNodesThatMatch(new TagNameFilter("P"));
代码示例来源:origin: eu.fbk.utils/utils-lsa
NodeList list = parser.extractAllNodesThatMatch(new TagNameFilter("P"));
代码示例来源:origin: de.jungblut.common/thomasjungblut-common
/**
* Extracts the title from the given HTML.
*
* @return never null, just an empty string if not parsable.
*/
public static String extractTitle(String html) throws ParserException {
String title = "";
Parser parser = new Parser(html);
NodeList matches = parser.extractAllNodesThatMatch(TITLE_FILTER);
SimpleNodeIterator it = matches.elements();
while (it.hasMoreNodes()) {
TitleTag node = (TitleTag) it.nextNode();
title = node.getTitle().trim();
}
return title;
}
代码示例来源:origin: de.jungblut.common/thomasjungblut-common
NodeList matches = parser.extractAllNodesThatMatch(LINK_FILTER);
SimpleNodeIterator it = matches.elements();
while (it.hasMoreNodes()) {
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
list = parser.extractAllNodesThatMatch (filter);
for (int i = 0; i < list.size (); i++)
System.out.println (list.elementAt (i).toHtml ());
代码示例来源:origin: dhis2/dhis2-core
Node[] tables = parser.extractAllNodesThatMatch( new TagNameFilter( "table" ) ).toNodeArray();
代码示例来源:origin: edu.umd/cloud9
list = parser.extractAllNodesThatMatch(filter);
代码示例来源:origin: edu.umd/cloud9
list = parser.extractAllNodesThatMatch(filter);
} catch (ParserException e) {
reporter.incrCounter(LinkCounter.PARSER_FAILED, 1);
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
NodeList links = new NodeList ();
parser = createParserParsingAnInputString(output);
links = parser.extractAllNodesThatMatch(filter);
代码示例来源:origin: org.htmlparser/htmlparser
NodeList links = new NodeList ();
parser = createParserParsingAnInputString(output);
links = parser.extractAllNodesThatMatch(filter);
代码示例来源:origin: org.htmlparser/htmlparser
NodeList links = new NodeList ();
parser = createParserParsingAnInputString(output);
links = parser.extractAllNodesThatMatch(filterLink);
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
NodeList links = new NodeList ();
parser = createParserParsingAnInputString(output);
links = parser.extractAllNodesThatMatch(filterLink);
内容来源于网络,如有侵权,请联系作者删除!