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