1 5 6 package org.w3c.tidy; 7 8 28 29 34 public class DOMNodeListImpl implements org.w3c.dom.NodeList { 35 36 private Node parent = null; 37 38 protected DOMNodeListImpl(Node parent) 39 { 40 this.parent = parent; 41 } 42 43 46 public org.w3c.dom.Node item(int index) 47 { 48 int i = 0; 49 Node node = parent.content; 50 while (node != null) { 51 if (i >= index) break; 52 i++; 53 node = node.next; 54 } 55 if (node != null) 56 return node.getAdapter(); 57 else 58 return null; 59 } 60 61 64 public int getLength() 65 { 66 int len = 0; 67 Node node = parent.content; 68 while (node != null) { 69 len++; 70 node = node.next; 71 } 72 return len; 73 } 74 75 } 76 | Popular Tags |