|
HTML Parser Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.htmlparser.util.NodeList
public class NodeList
| Constructor Summary | |
|---|---|
NodeList()
|
|
NodeList(Node node)
Create a one element node list. |
|
| Method Summary | |
|---|---|
void |
add(Node node)
|
void |
add(NodeList list)
Add another node list to this one. |
String |
asString()
|
boolean |
contains(Node node)
Check to see if the NodeList contains the supplied Node. |
void |
copyToNodeArray(Node[] array)
|
Node |
elementAt(int i)
|
SimpleNodeIterator |
elements()
|
NodeList |
extractAllNodesThatMatch(NodeFilter filter)
Filter the list with the given filter non-recursively. |
NodeList |
extractAllNodesThatMatch(NodeFilter filter,
boolean recursive)
Filter the list with the given filter. |
int |
indexOf(Node node)
Finds the index of the supplied Node. |
void |
keepAllNodesThatMatch(NodeFilter filter)
Remove nodes not matching the given filter non-recursively. |
void |
keepAllNodesThatMatch(NodeFilter filter,
boolean recursive)
Remove nodes not matching the given filter. |
void |
prepend(Node node)
Insert the given node at the head of the list. |
Node |
remove(int index)
Remove the node at index. |
boolean |
remove(Node node)
Remove the supplied Node from the list. |
void |
removeAll()
|
int |
size()
|
String |
toHtml()
Convert this nodelist into the equivalent HTML. |
String |
toHtml(boolean verbatim)
Convert this nodelist into the equivalent HTML. |
Node[] |
toNodeArray()
|
String |
toString()
Return the contents of the list as a string. |
void |
visitAllNodesWith(NodeVisitor visitor)
Utility to apply a visitor to a node list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NodeList()
public NodeList(Node node)
node - The initial node to add.| Method Detail |
|---|
public void add(Node node)
public void add(NodeList list)
list - The list to add.public void prepend(Node node)
node - The new first element.public int size()
public Node elementAt(int i)
public SimpleNodeIterator elements()
public Node[] toNodeArray()
public void copyToNodeArray(Node[] array)
public String asString()
public String toHtml(boolean verbatim)
verbatim - If true return as close to the original
page text as possible.
public String toHtml()
public Node remove(int index)
index - The index of the node to remove.
public void removeAll()
public boolean contains(Node node)
node - The node to look for.
public int indexOf(Node node)
node - The node to look for.
public boolean remove(Node node)
node - The node to remove.
public String toString()
toString in class Objectpublic NodeList extractAllNodesThatMatch(NodeFilter filter)
filter - The filter to use.
public NodeList extractAllNodesThatMatch(NodeFilter filter,
boolean recursive)
filter - The filter to use.recursive - If true digs into the children recursively.
- Returns:
- A new node array containing the nodes accepted by the filter.
This is a linear list and preserves the nested structure of the returned
nodes only.
public void keepAllNodesThatMatch(NodeFilter filter)
filter - The filter to use.
public void keepAllNodesThatMatch(NodeFilter filter,
boolean recursive)
filter - The filter to use.recursive - If true digs into the children recursively.
public void visitAllNodesWith(NodeVisitor visitor)
throws ParserException
Parser parser = new Parser ("http://whatever");
NodeList list = parser.parse (null); // no filter
list.visitAllNodesWith (visitor);
System.out.println (list.toHtml ());
ParserException
|
© 2006 Derrick Oswald Sep 17, 2006
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| HTML Parser is an open source library released under Common Public License. | |