01: package com.rimfaxe.xml.compatibility;
02:
03: import org.w3c.dom.NodeList;
04: import org.w3c.dom.Node;
05: import java.util.*;
06:
07: /**
08: * Wrapper around a vector of ElementImpl.
09:
10: <blockquote><small> Copyright (C) 2002 Hewlett-Packard Company.
11: This file is part of Sparta, an XML Parser, DOM, and XPath library.
12: This library is free software; you can redistribute it and/or
13: modify it under the terms of the <a href="doc-files/LGPL.txt">GNU
14: Lesser General Public License</a> as published by the Free Software
15: Foundation; either version 2.1 of the License, or (at your option)
16: any later version. This library is distributed in the hope that it
17: will be useful, but WITHOUT ANY WARRANTY; without even the implied
18: warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19: PURPOSE. </small></blockquote>
20: @version $Date: 2002/08/19 05:04:14 $ $Revision: 1.1.1.1 $
21: @author Eamonn O'Brien-Strain
22: * @stereotype container
23: */
24:
25: public class NodeListImpl implements NodeList {
26:
27: NodeListImpl(DocumentImpl doc, Enumeration i) {
28: list_ = new Vector();
29: while (i.hasMoreElements()) {
30: com.rimfaxe.xml.xmlreader.Node spartanNode = (com.rimfaxe.xml.xmlreader.Node) i
31: .nextElement();
32:
33: list_.addElement(doc.wrapper(spartanNode));
34: }
35:
36: }
37:
38: NodeListImpl(DocumentImpl doc, Vector list) {
39: this (doc, list.elements());
40: }
41:
42: public int getLength() {
43: return list_.size();
44: }
45:
46: public Node item(int i) {
47: return i < list_.size() ? (Node) list_.elementAt(i) : null;
48: }
49:
50: /** @associates ElementImpl */
51: private/*final (JDK11 problems)*/Vector list_;
52:
53: }
54:
55: // $Log: NodeListImpl.java,v $
56: // Revision 1.1.1.1 2002/08/19 05:04:14 eobrain
57: // import from HP Labs internal CVS
58: //
59: // Revision 1.8 2002/08/18 05:46:09 eob
60: // Add copyright and other formatting and commenting in preparation for
61: // release to SourceForge.
62: //
63: // Revision 1.7 2002/06/21 00:34:13 eob
64: // Make work with old JDK 1.1.*
65: //
66: // Revision 1.6 2002/05/23 21:33:50 eob
67: // Add constructor that takes vector. This optimization was done because
68: // of what performance profiling showed.
69: //
70: // Revision 1.5 2002/02/06 00:00:05 eob
71: // Handle case of getting non-existent node.
72: //
73: // Revision 1.4 2002/02/01 22:01:43 eob
74: // Comment change only.
75: //
76: // Revision 1.3 2002/01/05 08:06:55 eob
77: // tweak
78: //
79: // Revision 1.2 2002/01/04 00:52:35 eob
80: // Store wrapper as annotation of spartan object to avoid creating
81: // uncecessary wrapper objects, while still allowing garbage collection
82: // to clean the wrappers up.
83: //
84: // Revision 1.1 2002/01/04 18:42:51 eob
85: // initial
|