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