001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 /* 019 * $Id: DTMNodeListBase.java 468653 2006-10-28 07:07:05Z minchau $ 020 */ 021 package org.apache.xml.dtm.ref; 022 import org.w3c.dom.Node; 023 024 /** 025 * <code>DTMNodeList</code> gives us an implementation of the DOM's 026 * NodeList interface wrapped around a DTM Iterator. The author 027 * considers this something of an abominations, since NodeList was not 028 * intended to be a general purpose "list of nodes" API and is 029 * generally considered by the DOM WG to have be a mistake... but I'm 030 * told that some of the XPath/XSLT folks say they must have this 031 * solution. 032 * 033 * Please note that this is not necessarily equivlaent to a DOM 034 * NodeList operating over the same document. In particular: 035 * <ul> 036 * 037 * <li>If there are several Text nodes in logical succession (ie, 038 * across CDATASection and EntityReference boundaries), we will return 039 * only the first; the caller is responsible for stepping through 040 * them. 041 * (%REVIEW% Provide a convenience routine here to assist, pending 042 * proposed DOM Level 3 getAdjacentText() operation?) </li> 043 * 044 * <li>Since the whole XPath/XSLT architecture assumes that the source 045 * document is not altered while we're working with it, we do not 046 * promise to implement the DOM NodeList's "live view" response to 047 * document mutation. </li> 048 * 049 * </ul> 050 * 051 * <p>State: In progress!!</p> 052 * 053 */ 054 public class DTMNodeListBase implements org.w3c.dom.NodeList { 055 public DTMNodeListBase() { 056 } 057 058 //================================================================ 059 // org.w3c.dom.NodeList API follows 060 061 /** 062 * Returns the <code>index</code>th item in the collection. If 063 * <code>index</code> is greater than or equal to the number of nodes in 064 * the list, this returns <code>null</code>. 065 * @param index Index into the collection. 066 * @return The node at the <code>index</code>th position in the 067 * <code>NodeList</code>, or <code>null</code> if that is not a valid 068 * index. 069 */ 070 public Node item(int index) { 071 return null; 072 } 073 074 /** 075 * The number of nodes in the list. The range of valid child node indices 076 * is 0 to <code>length-1</code> inclusive. 077 */ 078 public int getLength() { 079 return 0; 080 } 081 }