KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > dom > html > HTMLCollection


1 /*
2  * Copyright (c) 2000 World Wide Web Consortium,
3  * (Massachusetts Institute of Technology, Institut National de
4  * Recherche en Informatique et en Automatique, Keio University). All
5  * Rights Reserved. This program is distributed under the W3C's Software
6  * Intellectual Property License. This program is distributed in the
7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
10  * details.
11  */

12
13 package org.w3c.dom.html;
14
15 import org.w3c.dom.Node JavaDoc;
16
17 /**
18  * An <code>HTMLCollection</code> is a list of nodes. An individual node may
19  * be accessed by either ordinal index or the node's<code>name</code> or
20  * <code>id</code> attributes. Note: Collections in the HTML DOM are assumed
21  * to be live meaning that they are automatically updated when the
22  * underlying document is changed.
23  * <p>See also the <a HREF='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
24  */

25 public interface HTMLCollection {
26     /**
27      * This attribute specifies the length or size of the list.
28      */

29     public int getLength();
30
31     /**
32      * This method retrieves a node specified by ordinal index. Nodes are
33      * numbered in tree order (depth-first traversal order).
34      * @param index The index of the node to be fetched. The index origin is
35      * 0.
36      * @return The <code>Node</code> at the corresponding position upon
37      * success. A value of <code>null</code> is returned if the index is
38      * out of range.
39      */

40     public Node JavaDoc item(int index);
41
42     /**
43      * This method retrieves a <code>Node</code> using a name. It first
44      * searches for a <code>Node</code> with a matching <code>id</code>
45      * attribute. If it doesn't find one, it then searches for a
46      * <code>Node</code> with a matching <code>name</code> attribute, but
47      * only on those elements that are allowed a name attribute.
48      * @param name The name of the <code>Node</code> to be fetched.
49      * @return The <code>Node</code> with a <code>name</code> or
50      * <code>id</code> attribute whose value corresponds to the specified
51      * string. Upon failure (e.g., no node with this name exists), returns
52      * <code>null</code> .
53      */

54     public Node JavaDoc namedItem(String JavaDoc name);
55
56 }
57
58
Popular Tags