2
* Copyright (c) 1998 World Wide Web Consortium, (Massachusetts Institute of
3
* Technology, Institut National de Recherche en Informatique et en
4
* Automatique, Keio University).
5
* All Rights Reserved. http://www.w3.org/Consortium/Legal/
8
package org.w3c.dom.html;
13
* An <code>HTMLDocument</code> is the root of the HTML hierarchy andholds the
14
* entire content. Beside providing access to the hierarchy, italso provides
15
* some convenience methods for accessing certain sets ofinformation from the
17
* <p>The following properties have been deprecated in favor of the
18
* corresponding ones for the BODY element:alinkColorbackgroundbgColorfgColor
22
public interface HTMLDocument extends Document {
24
* The title of a document as specified by the <code>TITLE</code>element in
25
* the head of the document.
27
public String getTitle();
28
public void setTitle(String title);
30
* Returns the URI of the page that linked to this page. The value isan
31
* empty string if the user navigated to the page directly (notthrough a
32
* link, but, for example, via a bookmark).
34
public String getReferrer();
36
* The domain name of the server that served the document, or a nullstring
37
* if the server cannot be identified by a domain name.
39
public String getDomain();
41
* The complete URI of the document.
43
public String getURL();
45
* The element that contains the content for the document. In documentswith
46
* <code>BODY</code> contents, returns the <code>BODY</code>element, and in
47
* frameset documents, this returns the outermost<code>FRAMESET</code>
50
public HTMLElement getBody();
51
public void setBody(HTMLElement body);
53
* A collection of all the <code>IMG</code> elements in a document.The
54
* behavior is limited to <code>IMG</code> elements forbackwards
57
public HTMLCollection getImages();
59
* A collection of all the <code>OBJECT</code> elements that includeapplets
60
* and <code>APPLET</code> (deprecated) elements ina document.
62
public HTMLCollection getApplets();
64
* A collection of all <code>AREA</code> elements andanchor (<code>A</code>)
65
* elements in a documentwith a value for the <code>href</code> attribute.
67
public HTMLCollection getLinks();
69
* A collection of all the forms of a document.
71
public HTMLCollection getForms();
73
* A collection of all the anchor (<code>A</code>) elements in a document
74
* with a value for the <code>name</code> attribute.Note. For reasons of
75
* backwardscompatibility, the returned set of anchors only contains those
76
* anchors created with the <code>name</code> attribute, not those created
77
* with the <code>id</code> attribute.
79
public HTMLCollection getAnchors();
81
* The cookies associated with this document. If there are none, thevalue is
82
* an empty string. Otherwise, the value is a string: asemicolon-delimited
83
* list of "name, value" pairs for all the cookiesassociated with the page.
84
* For example, <code>name=value;expires=date</code>.
86
public String getCookie();
87
public void setCookie(String cookie);
89
* Note.This method and the ones following allow a user to add to or replace
90
* the structuremodel of a document using strings of unparsed HTML. At the
91
* time of writing alternate methods for providing similar functionality
92
* for both HTML and XML documents were being considered. The following
93
* methodsmay be deprecated at some point in the future in favor of a more
94
* general-purpose mechanism.
95
* <br>Open a document stream for writing. If a document exists in the
96
* target, this method clears it.
100
* Closes a document stream opened by <code>open()</code>and forces
105
* Write a string of text to a document stream opened by<code>open()</code>.
106
* The text is parsed into the document's structuremodel.
107
* @param text The string to be parsed into some structure in the document
110
public void write(String text);
112
* Write a string of text followed by a newline character to a document
113
* stream opened by <code>open()</code>. The text is parsed into the
114
* document's structure model.
115
* @param text The string to be parsed into some structure in the document
118
public void writeln(String text);
120
* Returns the Element whose <code>id</code> is given by elementId. If no
121
* such element exists, returns <code>null</code>. Behavior is not defined
122
* if more than one element has this <code>id</code>.
123
* @param elementId The unique <code>id</code> value for an element.
124
* @return The matching element.
126
public Element getElementById(String elementId);
128
* Returns the (possibly empty) collection of elements whose<code>name</code>
129
* value is given by <code>elementName</code>.
130
* @param elementName The <code>name</code> attribute value for an element.
131
* @return The matching elements.
133
public NodeList getElementsByName(String elementName);