1 29 30 package com.caucho.quercus.lib.dom; 31 32 import org.w3c.dom.NodeList ; 33 34 import java.util.Iterator ; 35 36 public class DOMNodeList 37 extends DOMWrapper<NodeList > 38 { 39 40 DOMNodeList(DOMImplementation impl, NodeList nodeList) 41 { 42 super(impl, nodeList); 43 } 44 45 public DOMNode item(int index) 46 { 47 return wrap(_delegate.item(index)); 48 } 49 50 public int getLength() 51 { 52 return _delegate.getLength(); 53 } 54 55 public Iterator <DOMNode> iterator() 56 { 57 return new DOMNodeListIterator(); 58 } 59 60 public class DOMNodeListIterator 61 implements Iterator <DOMNode> 62 { 63 private int _index; 64 65 public boolean hasNext() 66 { 67 return _index < getLength(); 68 } 69 70 public DOMNode next() 71 { 72 return item(_index++); 73 } 74 75 public void remove() 76 { 77 throw new UnsupportedOperationException (); 78 } 79 } 80 81 public String toString() 82 { 83 return getClass().getSimpleName(); 84 } 85 } 86 | Popular Tags |