KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > dom > html > HTMLDocument


1 /*
2  * Copyright (c) 2000 World Wide Web Consortium,
3  * (Massachusetts Institute of Technology, Institut National de
4  * Recherche en Informatique et en Automatique, Keio University). All
5  * Rights Reserved. This program is distributed under the W3C's Software
6  * Intellectual Property License. This program is distributed in the
7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
10  * details.
11  */

12
13 package org.w3c.dom.html;
14
15 import org.w3c.dom.Document JavaDoc;
16 import org.w3c.dom.NodeList JavaDoc;
17
18 /**
19  * An <code>HTMLDocument</code> is the root of the HTML hierarchy and holds
20  * the entire content. Besides providing access to the hierarchy, it also
21  * provides some convenience methods for accessing certain sets of
22  * information from the document.
23  * <p> The following properties have been deprecated in favor of the
24  * corresponding ones for the <code>BODY</code> element: alinkColor background
25  * bgColor fgColor linkColor vlinkColor In DOM Level 2, the method
26  * <code>getElementById</code> is inherited from the <code>Document</code>
27  * interface where it was moved.
28  * <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>.
29  */

30 public interface HTMLDocument extends Document JavaDoc {
31     /**
32      * The title of a document as specified by the <code>TITLE</code> element
33      * in the head of the document.
34      */

35     public String JavaDoc getTitle();
36     public void setTitle(String JavaDoc title);
37
38     /**
39      * Returns the URI of the page that linked to this page. The value is an
40      * empty string if the user navigated to the page directly (not through a
41      * link, but, for example, via a bookmark).
42      */

43     public String JavaDoc getReferrer();
44
45     /**
46      * The domain name of the server that served the document, or
47      * <code>null</code> if the server cannot be identified by a domain name.
48      */

49     public String JavaDoc getDomain();
50
51     /**
52      * The complete URI of the document.
53      */

54     public String JavaDoc getURL();
55
56     /**
57      * The element that contains the content for the document. In documents
58      * with <code>BODY</code> contents, returns the <code>BODY</code>
59      * element. In frameset documents, this returns the outermost
60      * <code>FRAMESET</code> element.
61      */

62     public HTMLElement getBody();
63     public void setBody(HTMLElement body);
64
65     /**
66      * A collection of all the <code>IMG</code> elements in a document. The
67      * behavior is limited to <code>IMG</code> elements for backwards
68      * compatibility.
69      */

70     public HTMLCollection getImages();
71
72     /**
73      * A collection of all the <code>OBJECT</code> elements that include
74      * applets and <code>APPLET</code> ( deprecated ) elements in a document.
75      */

76     public HTMLCollection getApplets();
77
78     /**
79      * A collection of all <code>AREA</code> elements and anchor (
80      * <code>A</code> ) elements in a document with a value for the
81      * <code>href</code> attribute.
82      */

83     public HTMLCollection getLinks();
84
85     /**
86      * A collection of all the forms of a document.
87      */

88     public HTMLCollection getForms();
89
90     /**
91      * A collection of all the anchor (<code>A</code> ) elements in a document
92      * with a value for the <code>name</code> attribute. Note. For reasons
93      * of backwards compatibility, the returned set of anchors only contains
94      * those anchors created with the <code>name</code> attribute, not those
95      * created with the <code>id</code> attribute.
96      */

97     public HTMLCollection getAnchors();
98
99     /**
100      * The cookies associated with this document. If there are none, the
101      * value is an empty string. Otherwise, the value is a string: a
102      * semicolon-delimited list of "name, value" pairs for all the cookies
103      * associated with the page. For example,
104      * <code>name=value;expires=date</code> .
105      */

106     public String JavaDoc getCookie();
107     public void setCookie(String JavaDoc cookie);
108
109     /**
110      * Note. This method and the ones following allow a user to add to or
111      * replace the structure model of a document using strings of unparsed
112      * HTML. At the time of writing alternate methods for providing similar
113      * functionality for both HTML and XML documents were being considered.
114      * The following methods may be deprecated at some point in the future in
115      * favor of a more general-purpose mechanism.
116      * <br> Open a document stream for writing. If a document exists in the
117      * target, this method clears it.
118      */

119     public void open();
120
121     /**
122      * Closes a document stream opened by <code>open()</code> and forces
123      * rendering.
124      */

125     public void close();
126
127     /**
128      * Write a string of text to a document stream opened by
129      * <code>open()</code> . The text is parsed into the document's structure
130      * model.
131      * @param text The string to be parsed into some structure in the
132      * document structure model.
133      */

134     public void write(String JavaDoc text);
135
136     /**
137      * Write a string of text followed by a newline character to a document
138      * stream opened by <code>open()</code> . The text is parsed into the
139      * document's structure model.
140      * @param text The string to be parsed into some structure in the
141      * document structure model.
142      */

143     public void writeln(String JavaDoc text);
144
145     /**
146      * Returns the (possibly empty) collection of elements whose
147      * <code>name</code> value is given by <code>elementName</code> .
148      * @param elementName The <code>name</code> attribute value for an
149      * element.
150      * @return The matching elements.
151      */

152     public NodeList JavaDoc getElementsByName(String JavaDoc elementName);
153
154 }
155
156
Popular Tags