org.htmlparser.util
public class NodeList extends Object implements Serializable
| 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(boolean verbatim)
Convert this nodelist into the equivalent HTML. |
| String | toHtml()
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.
|
Parameters: node The initial node to add.
Parameters: list The list to add.
Parameters: node The node to look for.
Returns: True is the Node is in this NodeList.
Parameters: filter The filter to use.
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.
Parameters: 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.
Parameters: node The node to look for.
Returns: The index of the node in the list or -1 if it isn't found.
Parameters: filter The filter to use.
Parameters: filter The filter to use. recursive If true digs into the children recursively.
Parameters: node The new first element.
Parameters: index The index of the node to remove.
Returns: The node that was removed.
Parameters: node The node to remove.
Returns: True if the node was found and removed from the list.
Parameters: verbatim If true return as close to the original
page text as possible.
Returns: The contents of the list as HTML text.
Returns: The contents of the list as HTML text.
Returns: A string representation of the list.
Parser parser = new Parser ("http://whatever");
NodeList list = parser.parse (null); // no filter
list.visitAllNodesWith (visitor);
System.out.println (list.toHtml ());
| HTML Parser is an open source library released under LGPL. | |