001    /*
002     * Copyright (c) 2003 World Wide Web Consortium,
003     * (Massachusetts Institute of Technology, Institut National de
004     * Recherche en Informatique et en Automatique, Keio University). All
005     * Rights Reserved. This program is distributed under the W3C's Software
006     * Intellectual Property License. This program is distributed in the
007     * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008     * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009     * PURPOSE.
010     * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011     */
012    
013    package org.w3c.dom.html2;
014    
015    import org.w3c.dom.Node;
016    import org.w3c.dom.DOMException;
017    
018    /**
019     *  An <code>HTMLOptionsCollection</code> is a list of nodes representing HTML 
020     * option element. An individual node may be accessed by either ordinal 
021     * index or the node's <code>name</code> or <code>id</code> attributes.  
022     * Collections in the HTML DOM are assumed to be live meaning that they are 
023     * automatically updated when the underlying document is changed. 
024     * <p>See also the <a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>Document Object Model (DOM) Level 2 HTML Specification</a>.
025     * @since DOM Level 2
026     */
027    public interface HTMLOptionsCollection {
028        /**
029         *  This attribute specifies the length or size of the list. 
030         */
031        public int getLength();
032        /**
033         *  This attribute specifies the length or size of the list. 
034         * @exception DOMException
035         *    NOT_SUPPORTED_ERR: if setting the length is not allowed by the 
036         *   implementation. 
037         */
038        public void setLength(int length)
039                              throws DOMException;
040    
041        /**
042         *  This method retrieves a node specified by ordinal index. Nodes are 
043         * numbered in tree order (depth-first traversal order). 
044         * @param index The index of the node to be fetched. The index origin is 
045         *   0.
046         * @return The <code>Node</code> at the corresponding position upon 
047         *   success. A value of <code>null</code> is returned if the index is 
048         *   out of range. 
049         */
050        public Node item(int index);
051    
052        /**
053         * This method retrieves a <code>Node</code> using a name. It first 
054         * searches for a <code>Node</code> with a matching <code>id</code> 
055         * attribute. If it doesn't find one, it then searches for a 
056         * <code>Node</code> with a matching <code>name</code> attribute, but 
057         * only on those elements that are allowed a name attribute. This method 
058         * is case insensitive in HTML documents and case sensitive in XHTML 
059         * documents.
060         * @param name The name of the <code>Node</code> to be fetched.
061         * @return The <code>Node</code> with a <code>name</code> or 
062         *   <code>id</code> attribute whose value corresponds to the specified 
063         *   string. Upon failure (e.g., no node with this name exists), returns 
064         *   <code>null</code>.
065         */
066        public Node namedItem(String name);
067    
068    }