001/*
002 * Copyright (c) 2004 World Wide Web Consortium,
003 *
004 * (Massachusetts Institute of Technology, European Research Consortium for
005 * Informatics and Mathematics, Keio University). All Rights Reserved. This
006 * work is distributed under the W3C(r) Software License [1] in the hope that
007 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
008 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
009 *
010 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
011 */
012
013package org.w3c.dom;
014
015/**
016 *  The <code>NameList</code> interface provides the abstraction of an ordered 
017 * collection of parallel pairs of name and namespace values (which could be 
018 * null values), without defining or constraining how this collection is 
019 * implemented. The items in the <code>NameList</code> are accessible via an 
020 * integral index, starting from 0. 
021 * <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>.
022 * @since DOM Level 3
023 */
024public interface NameList {
025    /**
026     *  Returns the <code>index</code>th name item in the collection. 
027     * @param index Index into the collection.
028     * @return  The name at the <code>index</code>th position in the 
029     *   <code>NameList</code>, or <code>null</code> if there is no name for 
030     *   the specified index or if the index is out of range. 
031     */
032    public String getName(int index);
033
034    /**
035     *  Returns the <code>index</code>th namespaceURI item in the collection. 
036     * @param index Index into the collection.
037     * @return  The namespace URI at the <code>index</code>th position in the 
038     *   <code>NameList</code>, or <code>null</code> if there is no name for 
039     *   the specified index or if the index is out of range. 
040     */
041    public String getNamespaceURI(int index);
042
043    /**
044     *  The number of pairs (name and namespaceURI) in the list. The range of 
045     * valid child node indices is 0 to <code>length-1</code> inclusive. 
046     */
047    public int getLength();
048
049    /**
050     *  Test if a name is part of this <code>NameList</code>. 
051     * @param str  The name to look for. 
052     * @return  <code>true</code> if the name has been found, 
053     *   <code>false</code> otherwise. 
054     */
055    public boolean contains(String str);
056
057    /**
058     *  Test if the pair namespaceURI/name is part of this 
059     * <code>NameList</code>. 
060     * @param namespaceURI  The namespace URI to look for. 
061     * @param name  The name to look for. 
062     * @return  <code>true</code> if the pair namespaceURI/name has been 
063     *   found, <code>false</code> otherwise. 
064     */
065    public boolean containsNS(String namespaceURI, 
066                              String name);
067
068}