KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21 /*
22  * Copyright (c) 2003 World Wide Web Consortium,
23  * (Massachusetts Institute of Technology, Institut National de
24  * Recherche en Informatique et en Automatique, Keio University). All
25  * Rights Reserved. This program is distributed under the W3C's Software
26  * Intellectual Property License. This program is distributed in the
27  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
28  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
29  * PURPOSE.
30  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
31  */

32
33 package org.w3c.dom.html2;
34
35 import org.w3c.dom.Node JavaDoc;
36
37 /**
38  * An <code>HTMLCollection</code> is a list of nodes. An individual node may
39  * be accessed by either ordinal index or the node's <code>name</code> or
40  * <code>id</code> attributes. Collections in the HTML DOM are assumed to be
41  * live meaning that they are automatically updated when the underlying
42  * document is changed.
43  * <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>.
44  */

45 public interface HTMLCollection {
46     /**
47      * This attribute specifies the length or size of the list.
48      */

49     public int getLength();
50
51     /**
52      * This method retrieves a node specified by ordinal index. Nodes are
53      * numbered in tree order (depth-first traversal order).
54      * @param index The index of the node to be fetched. The index origin is
55      * <code>0</code>.
56      * @return The <code>Node</code> at the corresponding position upon
57      * success. A value of <code>null</code> is returned if the index is
58      * out of range.
59      */

60     public Node JavaDoc item(int index);
61
62     /**
63      * This method retrieves a <code>Node</code> using a name. With [<a HREF='http://www.w3.org/TR/1999/REC-html401-19991224'>HTML 4.01</a>]
64      * documents, it first searches for a <code>Node</code> with a matching
65      * <code>id</code> attribute. If it doesn't find one, it then searches
66      * for a <code>Node</code> with a matching <code>name</code> attribute,
67      * but only on those elements that are allowed a name attribute. With [<a HREF='http://www.w3.org/TR/2002/REC-xhtml1-20020801'>XHTML 1.0</a>]
68      * documents, this method only searches for <code>Nodes</code> with a
69      * matching <code>id</code> attribute. This method is case insensitive
70      * in HTML documents and case sensitive in XHTML documents.
71      * @param name The name of the <code>Node</code> to be fetched.
72      * @return The <code>Node</code> with a <code>name</code> or
73      * <code>id</code> attribute whose value corresponds to the specified
74      * string. Upon failure (e.g., no node with this name exists), returns
75      * <code>null</code>.
76      */

77     public Node JavaDoc namedItem(String JavaDoc name);
78
79 }
80
Popular Tags