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