01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.xslt;
06:
07: import org.w3c.dom.Node;
08: import org.w3c.dom.NodeList;
09: import org.apache.commons.logging.Log;
10: import org.apache.commons.logging.LogFactory;
11:
12: import java.util.List;
13:
14: /**
15: * @author <a href="mailto:meier@meisterbohne.de">Philipp Meier</a>
16: * Date: 10.10.2003
17: * Time: 20:40:44
18: */
19: public class SimpleNodeList implements NodeList {
20: //~ Instance fields ////////////////////////////////////////////////////////
21: private Log log = LogFactory.getLog(SimpleNodeList.class);
22:
23: private List nodes;
24:
25: //~ Constructors ///////////////////////////////////////////////////////////
26:
27: public SimpleNodeList(List nodes) {
28: this .nodes = nodes;
29: }
30:
31: //~ Methods ////////////////////////////////////////////////////////////////
32:
33: public int getLength() {
34: if (log.isTraceEnabled())
35: log.trace("getLength: " + nodes.size());
36: return nodes.size();
37: }
38:
39: public Node item(int i) {
40: log.trace("getItem: " + i);
41: return (Node) nodes.get(i);
42: }
43:
44: public String toString() {
45: StringBuffer sb = new StringBuffer("SimpleNodeList: [");
46: for (int i = 0; i < getLength(); i++)
47: sb.append(item(i).getNodeName() + ",");
48: sb.append("]");
49: return sb.toString();
50: }
51: }
|