01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: /*
17: * $Id: DTMNodeListBase.java,v 1.4 2005/01/24 00:34:35 mcnamara Exp $
18: */
19: package org.apache.xml.dtm.ref;
20:
21: import org.w3c.dom.Node;
22:
23: /**
24: * <code>DTMNodeList</code> gives us an implementation of the DOM's
25: * NodeList interface wrapped around a DTM Iterator. The author
26: * considers this something of an abominations, since NodeList was not
27: * intended to be a general purpose "list of nodes" API and is
28: * generally considered by the DOM WG to have be a mistake... but I'm
29: * told that some of the XPath/XSLT folks say they must have this
30: * solution.
31: *
32: * Please note that this is not necessarily equivlaent to a DOM
33: * NodeList operating over the same document. In particular:
34: * <ul>
35: *
36: * <li>If there are several Text nodes in logical succession (ie,
37: * across CDATASection and EntityReference boundaries), we will return
38: * only the first; the caller is responsible for stepping through
39: * them.
40: * (%REVIEW% Provide a convenience routine here to assist, pending
41: * proposed DOM Level 3 getAdjacentText() operation?) </li>
42: *
43: * <li>Since the whole XPath/XSLT architecture assumes that the source
44: * document is not altered while we're working with it, we do not
45: * promise to implement the DOM NodeList's "live view" response to
46: * document mutation. </li>
47: *
48: * </ul>
49: *
50: * <p>State: In progress!!</p>
51: *
52: */
53: public class DTMNodeListBase implements org.w3c.dom.NodeList {
54: public DTMNodeListBase() {
55: }
56:
57: //================================================================
58: // org.w3c.dom.NodeList API follows
59:
60: /**
61: * Returns the <code>index</code>th item in the collection. If
62: * <code>index</code> is greater than or equal to the number of nodes in
63: * the list, this returns <code>null</code>.
64: * @param index Index into the collection.
65: * @return The node at the <code>index</code>th position in the
66: * <code>NodeList</code>, or <code>null</code> if that is not a valid
67: * index.
68: */
69: public Node item(int index) {
70: return null;
71: }
72:
73: /**
74: * The number of nodes in the list. The range of valid child node indices
75: * is 0 to <code>length-1</code> inclusive.
76: */
77: public int getLength() {
78: return 0;
79: }
80: }
|