1 16 19 package com.sun.org.apache.xml.internal.dtm.ref; 20 21 import com.sun.org.apache.xml.internal.dtm.DTM; 22 import org.w3c.dom.Node ; 23 24 53 public class DTMChildIterNodeList extends DTMNodeListBase { 54 private int m_firstChild; 55 private DTM m_parentDTM; 56 57 private DTMChildIterNodeList() { 60 } 61 62 75 public DTMChildIterNodeList(DTM parentDTM,int parentHandle) { 76 m_parentDTM=parentDTM; 77 m_firstChild=parentDTM.getFirstChild(parentHandle); 78 } 79 80 81 84 93 public Node item(int index) { 94 int handle=m_firstChild; 95 while(--index>=0 && handle!=DTM.NULL) { 96 handle=m_parentDTM.getNextSibling(handle); 97 } 98 if (handle == DTM.NULL) { 99 return null; 100 } 101 return m_parentDTM.getNode(handle); 102 } 103 104 108 public int getLength() { 109 int count=0; 110 for (int handle=m_firstChild; 111 handle!=DTM.NULL; 112 handle=m_parentDTM.getNextSibling(handle)) { 113 ++count; 114 } 115 return count; 116 } 117 } 118 | Popular Tags |