001 /*
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003 *
004 * This code is free software; you can redistribute it and/or modify it
005 * under the terms of the GNU General Public License version 2 only, as
006 * published by the Free Software Foundation. Sun designates this
007 * particular file as subject to the "Classpath" exception as provided
008 * by Sun in the LICENSE file that accompanied this code.
009 *
010 * This code is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013 * version 2 for more details (a copy is included in the LICENSE file that
014 * accompanied this code).
015 *
016 * You should have received a copy of the GNU General Public License version
017 * 2 along with this work; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019 *
020 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021 * CA 95054 USA or visit www.sun.com if you need additional information or
022 * have any questions.
023 */
024
025 /*
026 * This file is available under and governed by the GNU General Public
027 * License version 2 only, as published by the Free Software Foundation.
028 * However, the following notice accompanied the original version of this
029 * file and, per its terms, should not be removed:
030 *
031 * Copyright (c) 2000 World Wide Web Consortium,
032 * (Massachusetts Institute of Technology, Institut National de
033 * Recherche en Informatique et en Automatique, Keio University). All
034 * Rights Reserved. This program is distributed under the W3C's Software
035 * Intellectual Property License. This program is distributed in the
036 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
037 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
038 * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
039 * details.
040 */
041
042 package org.w3c.dom.html;
043
044 import org.w3c.dom.Document;
045 import org.w3c.dom.NodeList;
046
047 /**
048 * An <code>HTMLDocument</code> is the root of the HTML hierarchy and holds
049 * the entire content. Besides providing access to the hierarchy, it also
050 * provides some convenience methods for accessing certain sets of
051 * information from the document.
052 * <p> The following properties have been deprecated in favor of the
053 * corresponding ones for the <code>BODY</code> element: alinkColor background
054 * bgColor fgColor linkColor vlinkColor In DOM Level 2, the method
055 * <code>getElementById</code> is inherited from the <code>Document</code>
056 * interface where it was moved.
057 * <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>.
058 */
059 public interface HTMLDocument extends Document {
060 /**
061 * The title of a document as specified by the <code>TITLE</code> element
062 * in the head of the document.
063 */
064 public String getTitle();
065
066 public void setTitle(String title);
067
068 /**
069 * Returns the URI of the page that linked to this page. The value is an
070 * empty string if the user navigated to the page directly (not through a
071 * link, but, for example, via a bookmark).
072 */
073 public String getReferrer();
074
075 /**
076 * The domain name of the server that served the document, or
077 * <code>null</code> if the server cannot be identified by a domain name.
078 */
079 public String getDomain();
080
081 /**
082 * The complete URI of the document.
083 */
084 public String getURL();
085
086 /**
087 * The element that contains the content for the document. In documents
088 * with <code>BODY</code> contents, returns the <code>BODY</code>
089 * element. In frameset documents, this returns the outermost
090 * <code>FRAMESET</code> element.
091 */
092 public HTMLElement getBody();
093
094 public void setBody(HTMLElement body);
095
096 /**
097 * A collection of all the <code>IMG</code> elements in a document. The
098 * behavior is limited to <code>IMG</code> elements for backwards
099 * 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
139 public void setCookie(String cookie);
140
141 /**
142 * Note. This method and the ones following allow a user to add to or
143 * replace the structure model of a document using strings of unparsed
144 * HTML. At the time of writing alternate methods for providing similar
145 * functionality for both HTML and XML documents were being considered.
146 * The following methods may be deprecated at some point in the future in
147 * favor of a more general-purpose mechanism.
148 * <br> Open a document stream for writing. If a document exists in the
149 * target, this method clears it.
150 */
151 public void open();
152
153 /**
154 * Closes a document stream opened by <code>open()</code> and forces
155 * rendering.
156 */
157 public void close();
158
159 /**
160 * Write a string of text to a document stream opened by
161 * <code>open()</code> . The text is parsed into the document's structure
162 * model.
163 * @param text The string to be parsed into some structure in the
164 * document structure model.
165 */
166 public void write(String text);
167
168 /**
169 * Write a string of text followed by a newline character to a document
170 * stream opened by <code>open()</code> . The text is parsed into the
171 * document's structure model.
172 * @param text The string to be parsed into some structure in the
173 * document structure model.
174 */
175 public void writeln(String text);
176
177 /**
178 * Returns the (possibly empty) collection of elements whose
179 * <code>name</code> value is given by <code>elementName</code> .
180 * @param elementName The <code>name</code> attribute value for an
181 * element.
182 * @return The matching elements.
183 */
184 public NodeList getElementsByName(String elementName);
185
186 }
|