1 20 21 25 26 package org.ozoneDB.xml.dom; 27 28 import org.w3c.dom.*; 29 import java.io.*; 30 import java.util.Vector ; 31 32 33 50 public final class NodeListImpl implements NodeList, Serializable { 51 52 final static long serialVersionUID = 1; 53 54 55 62 public Node item( int index ) { 63 return index >= 0 && index < _nodes.size() ? (Node)_nodes.elementAt( index ) : null; 64 } 65 66 67 71 public int getLength() { 72 return _nodes.size(); 73 } 74 75 76 80 public NodeListImpl( Node node ) { 81 if (node == null) { 82 throw new NullPointerException ( "Argument 'node' is null." ); 83 } 84 85 _rootNode = node; 86 _nodes = new Vector (); 87 88 Node child = node.getFirstChild(); 89 while (child != null) { 90 _nodes.addElement( child ); 91 child = child.getNextSibling(); 92 } 93 } 94 95 98 protected Node _rootNode; 99 protected Vector _nodes; 100 101 } 102 | Popular Tags |