本文整理了Java中org.htmlparser.Parser.elements()
方法的一些代码示例,展示了Parser.elements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.elements()
方法的具体详情如下:
包路径:org.htmlparser.Parser
类名称:Parser
方法名:elements
[英]Returns an iterator (enumeration) over the html nodes. org.htmlparser.nodes can be of three main types:
<<$0$>>
<<$0$>>
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
/**
* Assign the underlying node filter for this wrapper.
* @param filter The filter to wrap.
* @param context The parser to use for conditioning this filter.
* Some filters need contextual information to provide to the user,
* i.e. for tag names or attribute names or values,
* so the Parser context is provided.
*/
public void setNodeFilter (NodeFilter filter, Parser context)
{
Set set;
mFilter = (TagNameFilter)filter;
set = new HashSet ();
context.reset ();
try
{
for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); )
addName (set, iterator.nextNode ());
}
catch (ParserException pe)
{
// oh well, we tried
}
for (Iterator iterator = set.iterator (); iterator.hasNext (); )
mName.addItem (iterator.next ());
mName.setSelectedItem (mFilter.getName ());
}
代码示例来源:origin: deas/alfresco
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, false, overrideDocumentType);
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, true);
代码示例来源:origin: org.alfresco.surf/spring-webscripts
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, false, overrideDocumentType);
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, true);
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
try
for (NodeIterator iterator = context.elements (); iterator.hasMoreNodes (); )
addAttributes (set, iterator.nextNode ());
代码示例来源:origin: org.springframework.extensions.surf/spring-webscripts
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, false, overrideDocumentType);
PrototypicalNodeFactory factory = new PrototypicalNodeFactory();
parser.setNodeFactory(factory);
NodeIterator itr = parser.elements();
processNodes(buf, itr, true);
代码示例来源:origin: org.htmlparser/htmlparser
/**
* Extract all nodes matching the given filter.
* @see Node#collectInto(NodeList, NodeFilter)
* @param filter The filter to be applied to the nodes.
* @throws ParserException If a parse error occurs.
* @return A list of nodes matching the filter criteria,
* i.e. for which the filter's accept method
* returned <code>true</code>.
*/
public NodeList extractAllNodesThatMatch (NodeFilter filter)
throws
ParserException
{
NodeIterator e;
NodeList ret;
ret = new NodeList ();
for (e = elements (); e.hasMoreNodes (); )
e.nextNode ().collectInto (ret, filter);
return (ret);
}
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
/**
* Extract all nodes matching the given filter.
* @see Node#collectInto(NodeList, NodeFilter)
* @param filter The filter to be applied to the nodes.
* @throws ParserException If a parse error occurs.
* @return A list of nodes matching the filter criteria,
* i.e. for which the filter's accept method
* returned <code>true</code>.
*/
public NodeList extractAllNodesThatMatch (NodeFilter filter)
throws
ParserException
{
NodeIterator e;
NodeList ret;
ret = new NodeList ();
for (e = elements (); e.hasMoreNodes (); )
e.nextNode ().collectInto (ret, filter);
return (ret);
}
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
for (NodeIterator e = mParser.elements (); e.hasMoreNodes (); )
for (NodeIterator e = mParser.elements (); e.hasMoreNodes (); )
list.add (e.nextNode ());
代码示例来源:origin: org.htmlparser/htmlparser
for (NodeIterator iterator = mParser.elements (); iterator.hasMoreNodes (); )
doSAX (iterator.nextNode ());
mContentHandler.endDocument ();
代码示例来源:origin: org.htmlparser/htmlparser
/**
* Apply the given visitor to the current page.
* The visitor is passed to the <code>accept()</code> method of each node
* in the page in a depth first traversal. The visitor
* <code>beginParsing()</code> method is called prior to processing the
* page and <code>finishedParsing()</code> is called after the processing.
* @param visitor The visitor to visit all nodes with.
* @throws ParserException If a parse error occurs while traversing
* the page with the visitor.
*/
public void visitAllNodesWith (NodeVisitor visitor) throws ParserException
{
Node node;
visitor.beginParsing();
for (NodeIterator e = elements(); e.hasMoreNodes(); )
{
node = e.nextNode();
node.accept(visitor);
}
visitor.finishedParsing();
}
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
/**
* Apply the given visitor to the current page.
* The visitor is passed to the <code>accept()</code> method of each node
* in the page in a depth first traversal. The visitor
* <code>beginParsing()</code> method is called prior to processing the
* page and <code>finishedParsing()</code> is called after the processing.
* @param visitor The visitor to visit all nodes with.
* @throws ParserException If a parse error occurs while traversing
* the page with the visitor.
*/
public void visitAllNodesWith (NodeVisitor visitor) throws ParserException
{
Node node;
visitor.beginParsing();
for (NodeIterator e = elements(); e.hasMoreNodes(); )
{
node = e.nextNode();
node.accept(visitor);
}
visitor.finishedParsing();
}
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
for (NodeIterator iterator = mParser.elements (); iterator.hasMoreNodes (); )
doSAX (iterator.nextNode ());
mContentHandler.endDocument ();
代码示例来源:origin: org.htmlparser/htmlparser
for (NodeIterator iterator = mParser.elements ();
iterator.hasMoreNodes ();
doSAX (iterator.nextNode ()));
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
for (e = elements (); e.hasMoreNodes (); )
代码示例来源:origin: org.htmlparser/htmlparser
for (e = elements (); e.hasMoreNodes (); )
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
try
for (NodeIterator iterator = parser.elements (); iterator.hasMoreNodes (); )
list.add (iterator.nextNode ());
for (NodeIterator iterator = parser.elements (); iterator.hasMoreNodes (); )
list.add (iterator.nextNode ());
代码示例来源:origin: com.bbossgroups/bboss-htmlparser
for (NodeIterator iterator = mParser.elements ();
iterator.hasMoreNodes ();
doSAX (iterator.nextNode ()));
内容来源于网络,如有侵权,请联系作者删除!