- Timestamp:
- 2006-12-20T14:46:19+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/ArrayTools.java
r8262 r13535 252 252 } 253 253 254 /** Method to convert a list of nodes from the DOM model into a node array. This is quite useful as using a <strong>NodeList</strong> is problematic if you wish to traverse the tree while editing. Because they are 'live' representations of the model you are editing, it is easy to drop out of for loops early or run off the ends of arrays. 255 * @param node_list A <strong>NodeList</strong> representing the <strong>Node</strong>s we want to iterate through. 256 * @return A brand new <strong>Node[]</strong> with the first <strong>Node</strong> in the <strong>NodeList</strong> at the head. 257 * @see org.w3c.dom.Node 258 * @see org.w3c.dom.NodeList 259 */ 260 static public Node[] nodeListToNodeArray(NodeList node_list) { 261 Node nodes[] = null; 262 for(int i = 0; i < node_list.getLength(); i++) { 263 nodes = add(nodes, node_list.item(i)); 264 } 265 return nodes; 266 } 254 267 255 /** Transforms an Object array into a single string of the form '[o1,o2,...,on]'. 268 256 * @param objects An <strong>Object[]</strong>. Note that the objects in this array must support toString() reasonably.
Note:
See TracChangeset
for help on using the changeset viewer.