public class NodeList
extends java.lang.Object
implements java.util.List, java.lang.Cloneable
toString() method that will output the XML serialized form of the
nodes it contains - again focusing on template engine usage, as well as the
selectNodes(String) method that helps selecting a different set of nodes
starting from the nodes in this list. The class also implements the List
interface by simply delegating calls to the contained list (the subList(int, int)
method is implemented by delegating to the contained list and wrapping the returned
sublist into a NodeList).| 构造器和说明 |
|---|
NodeList()
Creates an empty node list.
|
NodeList(org.jdom.Document document)
Creates a node list that holds a single
Document node. |
NodeList(org.jdom.Element element)
Creates a node list that holds a single
Element node. |
NodeList(java.util.List nodes)
Creates a node list that holds a list of nodes.
|
NodeList(java.util.List nodes,
boolean copy)
Creates a node list that holds a list of nodes.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(int index,
java.lang.Object o) |
boolean |
add(java.lang.Object o) |
boolean |
addAll(java.util.Collection c) |
boolean |
addAll(int index,
java.util.Collection c) |
void |
clear() |
java.lang.Object |
clone()
Returns a NodeList that contains the same nodes as this node list.
|
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection c) |
boolean |
equals(java.lang.Object o)
Tests for equality with another object.
|
java.lang.Object |
get(int index) |
java.util.List |
getList()
Retrieves the underlying list used to store the nodes.
|
int |
hashCode()
Returns the hash code of the contained list.
|
int |
indexOf(java.lang.Object o) |
boolean |
isEmpty() |
java.util.Iterator |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator |
listIterator() |
java.util.ListIterator |
listIterator(int index) |
java.lang.Object |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection c) |
boolean |
retainAll(java.util.Collection c) |
NodeList |
selectNodes(java.lang.String xpathString)
Applies an XPath expression to the node list and returns the resulting
node list.
|
java.lang.Object |
set(int index,
java.lang.Object o) |
int |
size() |
java.util.List |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] a) |
java.lang.String |
toString()
This method returns the string resulting from concatenation of string
representations of its nodes.
|
public NodeList()
public NodeList(org.jdom.Document document)
Document node.document - public NodeList(org.jdom.Element element)
Element node.element - public NodeList(java.util.List nodes)
nodes - the list of nodes this template should hold. The created
template will copy the passed nodes list, so changes to the passed list
will not affect the model.public NodeList(java.util.List nodes,
boolean copy)
nodes - the list of nodes this template should hold.copy - if true, the created template will copy the passed nodes
list, so changes to the passed list will not affect the model. If false,
the model will reference the passed list and will sense changes in it,
altough no operations on the list will be synchronized.public java.util.List getList()
List interface
of this class itself. You would probably access the underlying list only for
synchronization purposes.public java.lang.String toString()
toString 在类中 java.lang.Objectpublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone 在类中 java.lang.Objectjava.lang.CloneNotSupportedException - if the contained list's class does
not have an accessible no-arg constructor.public int hashCode()
hashCode 在接口中 java.util.CollectionhashCode 在接口中 java.util.ListhashCode 在类中 java.lang.Objectpublic boolean equals(java.lang.Object o)
equals 在接口中 java.util.Collectionequals 在接口中 java.util.Listequals 在类中 java.lang.Objecto - the object to test for equalityList objects evaluate as equals.public NodeList selectNodes(java.lang.String xpathString)
xpathString - the XPath expression you wish to applypublic boolean add(java.lang.Object o)
add 在接口中 java.util.Collectionadd 在接口中 java.util.ListList.add(java.lang.Object)public void add(int index,
java.lang.Object o)
add 在接口中 java.util.ListList.add(int, java.lang.Object)public boolean addAll(java.util.Collection c)
addAll 在接口中 java.util.CollectionaddAll 在接口中 java.util.ListList.addAll(java.util.Collection)public boolean addAll(int index,
java.util.Collection c)
addAll 在接口中 java.util.ListList.addAll(int, java.util.Collection)public void clear()
clear 在接口中 java.util.Collectionclear 在接口中 java.util.ListList.clear()public boolean contains(java.lang.Object o)
contains 在接口中 java.util.Collectioncontains 在接口中 java.util.ListList.contains(java.lang.Object)public boolean containsAll(java.util.Collection c)
containsAll 在接口中 java.util.CollectioncontainsAll 在接口中 java.util.ListList.containsAll(java.util.Collection)public java.lang.Object get(int index)
get 在接口中 java.util.ListList.get(int)public int indexOf(java.lang.Object o)
indexOf 在接口中 java.util.ListList.indexOf(java.lang.Object)public boolean isEmpty()
isEmpty 在接口中 java.util.CollectionisEmpty 在接口中 java.util.ListList.isEmpty()public java.util.Iterator iterator()
iterator 在接口中 java.lang.Iterableiterator 在接口中 java.util.Collectioniterator 在接口中 java.util.ListList.iterator()public int lastIndexOf(java.lang.Object o)
lastIndexOf 在接口中 java.util.ListList.lastIndexOf(java.lang.Object)public java.util.ListIterator listIterator()
listIterator 在接口中 java.util.ListList.listIterator()public java.util.ListIterator listIterator(int index)
listIterator 在接口中 java.util.ListList.listIterator(int)public java.lang.Object remove(int index)
remove 在接口中 java.util.ListList.remove(int)public boolean remove(java.lang.Object o)
remove 在接口中 java.util.Collectionremove 在接口中 java.util.ListList.remove(java.lang.Object)public boolean removeAll(java.util.Collection c)
removeAll 在接口中 java.util.CollectionremoveAll 在接口中 java.util.ListList.removeAll(java.util.Collection)public boolean retainAll(java.util.Collection c)
retainAll 在接口中 java.util.CollectionretainAll 在接口中 java.util.ListList.retainAll(java.util.Collection)public java.lang.Object set(int index,
java.lang.Object o)
set 在接口中 java.util.ListList.set(int, java.lang.Object)public int size()
size 在接口中 java.util.Collectionsize 在接口中 java.util.ListList.size()public java.util.List subList(int fromIndex,
int toIndex)
subList 在接口中 java.util.ListList.subList(int, int)public java.lang.Object[] toArray()
toArray 在接口中 java.util.CollectiontoArray 在接口中 java.util.ListList.toArray()public java.lang.Object[] toArray(java.lang.Object[] a)
toArray 在接口中 java.util.CollectiontoArray 在接口中 java.util.ListList.toArray(java.lang.Object[])