12005
|
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 |
|
|
42 |
package org.w3c.dom.html;
|
|
43 |
|
|
44 |
import org.w3c.dom.Document;
|
|
45 |
import 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 |
public interface HTMLDocument extends Document {
|
|
60 |
/**
|
|
61 |
* The title of a document as specified by the <code>TITLE</code> element
|
|
62 |
* in the head of the document.
|
|
63 |
*/
|
|
64 |
public String getTitle();
|
|
65 |
public void setTitle(String title);
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Returns the URI of the page that linked to this page. The value is an
|
|
69 |
* empty string if the user navigated to the page directly (not through a
|
|
70 |
* link, but, for example, via a bookmark).
|
|
71 |
*/
|
|
72 |
public String getReferrer();
|
|
73 |
|
|
74 |
/**
|
|
75 |
* The domain name of the server that served the document, or
|
|
76 |
* <code>null</code> if the server cannot be identified by a domain name.
|
|
77 |
*/
|
|
78 |
public String getDomain();
|
|
79 |
|
|
80 |
/**
|
|
81 |
* The complete URI of the document.
|
|
82 |
*/
|
|
83 |
public String getURL();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* The element that contains the content for the document. In documents
|
|
87 |
* with <code>BODY</code> contents, returns the <code>BODY</code>
|
|
88 |
* element. In frameset documents, this returns the outermost
|
|
89 |
* <code>FRAMESET</code> element.
|
|
90 |
*/
|
|
91 |
public HTMLElement getBody();
|
|
92 |
public void setBody(HTMLElement body);
|
|
93 |
|
|
94 |
/**
|
|
95 |
* A collection of all the <code>IMG</code> elements in a document. The
|
|
96 |
* behavior is limited to <code>IMG</code> elements for backwards
|
|
97 |
* compatibility.
|
|
98 |
*/
|
|
99 |
public HTMLCollection getImages();
|
|
100 |
|
|
101 |
/**
|
|
102 |
* A collection of all the <code>OBJECT</code> elements that include
|
|
103 |
* applets and <code>APPLET</code> ( deprecated ) elements in a document.
|
|
104 |
*/
|
|
105 |
public HTMLCollection getApplets();
|
|
106 |
|
|
107 |
/**
|
|
108 |
* A collection of all <code>AREA</code> elements and anchor (
|
|
109 |
* <code>A</code> ) elements in a document with a value for the
|
|
110 |
* <code>href</code> attribute.
|
|
111 |
*/
|
|
112 |
public HTMLCollection getLinks();
|
|
113 |
|
|
114 |
/**
|
|
115 |
* A collection of all the forms of a document.
|
|
116 |
*/
|
|
117 |
public HTMLCollection getForms();
|
|
118 |
|
|
119 |
/**
|
|
120 |
* A collection of all the anchor (<code>A</code> ) elements in a document
|
|
121 |
* with a value for the <code>name</code> attribute. Note. For reasons
|
|
122 |
* of backwards compatibility, the returned set of anchors only contains
|
|
123 |
* those anchors created with the <code>name</code> attribute, not those
|
|
124 |
* created with the <code>id</code> attribute.
|
|
125 |
*/
|
|
126 |
public HTMLCollection getAnchors();
|
|
127 |
|
|
128 |
/**
|
|
129 |
* The cookies associated with this document. If there are none, the
|
|
130 |
* value is an empty string. Otherwise, the value is a string: a
|
|
131 |
* semicolon-delimited list of "name, value" pairs for all the cookies
|
|
132 |
* associated with the page. For example,
|
|
133 |
* <code>name=value;expires=date</code> .
|
|
134 |
*/
|
|
135 |
public String getCookie();
|
|
136 |
public void setCookie(String cookie);
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Note. This method and the ones following allow a user to add to or
|
|
140 |
* replace the structure model of a document using strings of unparsed
|
|
141 |
* HTML. At the time of writing alternate methods for providing similar
|
|
142 |
* functionality for both HTML and XML documents were being considered.
|
|
143 |
* The following methods may be deprecated at some point in the future in
|
|
144 |
* favor of a more general-purpose mechanism.
|
|
145 |
* <br> Open a document stream for writing. If a document exists in the
|
|
146 |
* target, this method clears it.
|
|
147 |
*/
|
|
148 |
public void open();
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Closes a document stream opened by <code>open()</code> and forces
|
|
152 |
* rendering.
|
|
153 |
*/
|
|
154 |
public void close();
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Write a string of text to a document stream opened by
|
|
158 |
* <code>open()</code> . The text is parsed into the document's structure
|
|
159 |
* model.
|
|
160 |
* @param text The string to be parsed into some structure in the
|
|
161 |
* document structure model.
|
|
162 |
*/
|
|
163 |
public void write(String text);
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Write a string of text followed by a newline character to a document
|
|
167 |
* stream opened by <code>open()</code> . The text is parsed into the
|
|
168 |
* document's structure model.
|
|
169 |
* @param text The string to be parsed into some structure in the
|
|
170 |
* document structure model.
|
|
171 |
*/
|
|
172 |
public void writeln(String text);
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Returns the (possibly empty) collection of elements whose
|
|
176 |
* <code>name</code> value is given by <code>elementName</code> .
|
|
177 |
* @param elementName The <code>name</code> attribute value for an
|
|
178 |
* element.
|
|
179 |
* @return The matching elements.
|
|
180 |
*/
|
|
181 |
public NodeList getElementsByName(String elementName);
|
|
182 |
|
|
183 |
}
|