1 30 31 package com.caucho.eswrap.org.w3c.dom; 32 33 import org.w3c.dom.NodeList ; 34 35 import java.util.Iterator ; 36 37 public class NodeListEcmaWrap { 38 static class NodeListIterator implements Iterator { 39 NodeList list; 40 int index; 41 42 public boolean hasNext() 43 { 44 return index < list.getLength(); 45 } 46 47 public Object next() 48 { 49 return index < list.getLength() ? list.item(index++) : null; 50 } 51 52 public void remove() 53 { 54 throw new UnsupportedOperationException (); 55 } 56 57 NodeListIterator(NodeList list) 58 { 59 this.list = list; 60 this.index = 0; 61 } 62 } 63 64 public static Iterator keys(NodeList nodeList) 65 { 66 return new NodeListIterator(nodeList); 67 } 68 } 69 70 | Popular Tags |