1 16 17 package org.apache.axis.message; 18 19 import org.w3c.dom.Node ; 20 import org.w3c.dom.NodeList ; 21 22 import java.util.ArrayList ; 23 import java.util.Collection ; 24 import java.util.Collections ; 25 import java.util.List ; 26 27 33 34 class NodeListImpl implements NodeList { 35 List mNodes; 36 37 public static final NodeList EMPTY_NODELIST = new NodeListImpl(Collections.EMPTY_LIST); 38 39 43 NodeListImpl() { 44 mNodes = new ArrayList (); 45 } 46 47 NodeListImpl(List nodes) { 48 this(); 49 mNodes.addAll(nodes); 50 } 51 52 void addNode(org.w3c.dom.Node node) { 53 mNodes.add(node); 54 } 55 56 void addNodeList(org.w3c.dom.NodeList nodes) { 57 for (int i = 0; i < nodes.getLength(); i++) { 58 mNodes.add(nodes.item(i)); 59 } 60 } 61 62 68 public Node item(int index) { 69 if (mNodes != null && mNodes.size() > index) { 70 return (Node ) mNodes.get(index); 71 } else { 72 return null; 73 } 74 } 75 76 public int getLength() { 77 return mNodes.size(); 78 } 79 80 } 81 | Popular Tags |