1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25/*
26 * This file is available under and governed by the GNU General Public
27 * License version 2 only, as published by the Free Software Foundation.
28 * However, the following notice accompanied the original version of this
29 * file and, per its terms, should not be removed:
30 *
31 * Copyright (c) 2000 World Wide Web Consortium,
32 * (Massachusetts Institute of Technology, Institut National de
33 * Recherche en Informatique et en Automatique, Keio University). All
34 * Rights Reserved. This program is distributed under the W3C's Software
35 * Intellectual Property License. This program is distributed in the
36 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
37 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
38 * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
39 * details.
40 */
41
42package org.w3c.dom.html;
43
44import org.w3c.dom.Document;
45import org.w3c.dom.NodeList;
46
47/**
48 *  An <code>HTMLDocument</code> is the root of the HTML hierarchy and holds
49 * the entire content. Besides providing access to the hierarchy, it also
50 * provides some convenience methods for accessing certain sets of
51 * information from the document.
52 * <p> The following properties have been deprecated in favor of the
53 * corresponding ones for the <code>BODY</code> element: alinkColor background
54 *  bgColor fgColor linkColor vlinkColor In DOM Level 2, the method
55 * <code>getElementById</code> is inherited from the <code>Document</code>
56 * interface where it was moved.
57 * <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>.
58 *
59 * @since 1.4, DOM Level 2
60 */
61public interface HTMLDocument extends Document {
62    /**
63     *  The title of a document as specified by the <code>TITLE</code> element
64     * in the head of the document.
65     */
66    public String getTitle();
67    public void setTitle(String title);
68
69    /**
70     *  Returns the URI  of the page that linked to this page. The value is an
71     * empty string if the user navigated to the page directly (not through a
72     * link, but, for example, via a bookmark).
73     */
74    public String getReferrer();
75
76    /**
77     *  The domain name of the server that served the document, or
78     * <code>null</code> if the server cannot be identified by a domain name.
79     */
80    public String getDomain();
81
82    /**
83     *  The complete URI  of the document.
84     */
85    public String getURL();
86
87    /**
88     *  The element that contains the content for the document. In documents
89     * with <code>BODY</code> contents, returns the <code>BODY</code>
90     * element. In frameset documents, this returns the outermost
91     * <code>FRAMESET</code> element.
92     */
93    public HTMLElement getBody();
94    public void setBody(HTMLElement body);
95
96    /**
97     *  A collection of all the <code>IMG</code> elements in a document. The
98     * behavior is limited to <code>IMG</code> elements for backwards
99     * compatibility.
100     */
101    public HTMLCollection getImages();
102
103    /**
104     *  A collection of all the <code>OBJECT</code> elements that include
105     * applets and <code>APPLET</code> ( deprecated ) elements in a document.
106     */
107    public HTMLCollection getApplets();
108
109    /**
110     *  A collection of all <code>AREA</code> elements and anchor (
111     * <code>A</code> ) elements in a document with a value for the
112     * <code>href</code> attribute.
113     */
114    public HTMLCollection getLinks();
115
116    /**
117     *  A collection of all the forms of a document.
118     */
119    public HTMLCollection getForms();
120
121    /**
122     *  A collection of all the anchor (<code>A</code> ) elements in a document
123     *  with a value for the <code>name</code> attribute. Note. For reasons
124     * of backwards compatibility, the returned set of anchors only contains
125     * those anchors created with the <code>name</code>  attribute, not those
126     * created with the <code>id</code> attribute.
127     */
128    public HTMLCollection getAnchors();
129
130    /**
131     *  The cookies associated with this document. If there are none, the
132     * value is an empty string. Otherwise, the value is a string: a
133     * semicolon-delimited list of "name, value" pairs for all the cookies
134     * associated with the page. For example,
135     * <code>name=value;expires=date</code> .
136     */
137    public String getCookie();
138    public void setCookie(String cookie);
139
140    /**
141     *  Note. This method and the ones following  allow a user to add to or
142     * replace the structure model of a document using strings of unparsed
143     * HTML. At the time of  writing alternate methods for providing similar
144     * functionality for  both HTML and XML documents were being considered.
145     * The following methods may be deprecated at some point in the future in
146     * favor of a more general-purpose mechanism.
147     * <br> Open a document stream for writing. If a document exists in the
148     * target, this method clears it.
149     */
150    public void open();
151
152    /**
153     *  Closes a document stream opened by <code>open()</code> and forces
154     * rendering.
155     */
156    public void close();
157
158    /**
159     *  Write a string of text to a document stream opened by
160     * <code>open()</code> . The text is parsed into the document's structure
161     * model.
162     * @param text  The string to be parsed into some structure in the
163     *   document structure model.
164     */
165    public void write(String text);
166
167    /**
168     *  Write a string of text followed by a newline character to a document
169     * stream opened by <code>open()</code> . The text is parsed into the
170     * document's structure model.
171     * @param text  The string to be parsed into some structure in the
172     *   document structure model.
173     */
174    public void writeln(String text);
175
176    /**
177     *  Returns the (possibly empty) collection of elements whose
178     * <code>name</code> value is given by <code>elementName</code> .
179     * @param elementName  The <code>name</code> attribute value for an
180     *   element.
181     * @return  The matching elements.
182     */
183    public NodeList getElementsByName(String elementName);
184
185}
186