|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.dom.SimpleHtmlCollection
public class SimpleHtmlCollection
An implementation of HTMLCollection which also implements
Iterable. This allows you to use a SimpleHtmlCollection in an enhanced
for loop, such as:
SimpleHtmlCollection nodes = ...;
for (Node n : nodes) {
System.out.println(n.getTextContent());
}
SimpleHtmlCollection wraps a source HtmlCollection. So any normal HTMLCollection can be adapted for use with enhanced for loops by wrapping it in a SimpleHtmlCollection.
| Constructor Summary | |
|---|---|
SimpleHtmlCollection(org.w3c.dom.html.HTMLCollection list)
Creates a new instance of SimpleHtmlCollection. |
|
| Method Summary | |
|---|---|
int |
getLength()
This attribute specifies the length or size of the list. |
Node |
item(int index)
This method retrieves a node specified by ordinal index. |
Iterator<Node> |
iterator()
Returns an iterator over a set of elements of type T. |
Node |
namedItem(String name)
This method retrieves a Node using a name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleHtmlCollection(org.w3c.dom.html.HTMLCollection list)
list - the HTMLCollection to wrap.| Method Detail |
|---|
public Node item(int index)
org.w3c.dom.html.HTMLCollection
item in interface org.w3c.dom.html.HTMLCollectionindex - The index of the node to be fetched. The index origin is
0.
Node at the corresponding position upon
success. A value of null is returned if the index is
out of range.public int getLength()
org.w3c.dom.html.HTMLCollection
getLength in interface org.w3c.dom.html.HTMLCollectionpublic Iterator<Node> iterator()
java.lang.Iterable
iterator in interface Iterable<Node>public Node namedItem(String name)
org.w3c.dom.html.HTMLCollectionNode using a name. It first
searches for a Node with a matching id
attribute. If it doesn't find one, it then searches for a
Node with a matching name attribute, but
only on those elements that are allowed a name attribute.
namedItem in interface org.w3c.dom.html.HTMLCollectionname - The name of the Node to be fetched.
Node with a name or
id attribute whose value corresponds to the specified
string. Upon failure (e.g., no node with this name exists), returns
null .
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||