1 /* 2 * Copyright (c) 2004 World Wide Web Consortium, 3 * 4 * (Massachusetts Institute of Technology, European Research Consortium for 5 * Informatics and Mathematics, Keio University). All Rights Reserved. This 6 * work is distributed under the W3C(r) Software License [1] in the hope that 7 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 8 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 * 10 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 11 */ 12 13 package org.w3c.dom; 14 15 /** 16 * The <code>NameList</code> interface provides the abstraction of an ordered 17 * collection of parallel pairs of name and namespace values (which could be 18 * null values), without defining or constraining how this collection is 19 * implemented. The items in the <code>NameList</code> are accessible via an 20 * integral index, starting from 0. 21 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>. 22 * @since DOM Level 3 23 */ 24 public interface NameList { 25 /** 26 * Returns the <code>index</code>th name item in the collection. 27 * @param index Index into the collection. 28 * @return The name at the <code>index</code>th position in the 29 * <code>NameList</code>, or <code>null</code> if there is no name for 30 * the specified index or if the index is out of range. 31 */ getName(int index)32 public String getName(int index); 33 34 /** 35 * Returns the <code>index</code>th namespaceURI item in the collection. 36 * @param index Index into the collection. 37 * @return The namespace URI at the <code>index</code>th position in the 38 * <code>NameList</code>, or <code>null</code> if there is no name for 39 * the specified index or if the index is out of range. 40 */ getNamespaceURI(int index)41 public String getNamespaceURI(int index); 42 43 /** 44 * The number of pairs (name and namespaceURI) in the list. The range of 45 * valid child node indices is 0 to <code>length-1</code> inclusive. 46 */ getLength()47 public int getLength(); 48 49 /** 50 * Test if a name is part of this <code>NameList</code>. 51 * @param str The name to look for. 52 * @return <code>true</code> if the name has been found, 53 * <code>false</code> otherwise. 54 */ contains(String str)55 public boolean contains(String str); 56 57 /** 58 * Test if the pair namespaceURI/name is part of this 59 * <code>NameList</code>. 60 * @param namespaceURI The namespace URI to look for. 61 * @param name The name to look for. 62 * @return <code>true</code> if the pair namespaceURI/name has been 63 * found, <code>false</code> otherwise. 64 */ containsNS(String namespaceURI, String name)65 public boolean containsNS(String namespaceURI, 66 String name); 67 68 } 69