001: /*
002: * Copyright (c) 2000 World Wide Web Consortium,
003: * (Massachusetts Institute of Technology, Institut National de
004: * Recherche en Informatique et en Automatique, Keio University). All
005: * Rights Reserved. This program is distributed under the W3C's Software
006: * Intellectual Property License. This program is distributed in the
007: * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008: * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009: * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
010: * details.
011: */
012:
013: package org.w3c.dom.html;
014:
015: import org.w3c.dom.Document;
016: import org.w3c.dom.NodeList;
017:
018: /**
019: * An <code>HTMLDocument</code> is the root of the HTML hierarchy and holds
020: * the entire content. Besides providing access to the hierarchy, it also
021: * provides some convenience methods for accessing certain sets of
022: * information from the document.
023: * <p> The following properties have been deprecated in favor of the
024: * corresponding ones for the <code>BODY</code> element: alinkColor background
025: * bgColor fgColor linkColor vlinkColor In DOM Level 2, the method
026: * <code>getElementById</code> is inherited from the <code>Document</code>
027: * interface where it was moved.
028: * <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>.
029: */
030: public interface HTMLDocument extends Document {
031: /**
032: * The title of a document as specified by the <code>TITLE</code> element
033: * in the head of the document.
034: */
035: public String getTitle();
036:
037: public void setTitle(String title);
038:
039: /**
040: * Returns the URI of the page that linked to this page. The value is an
041: * empty string if the user navigated to the page directly (not through a
042: * link, but, for example, via a bookmark).
043: */
044: public String getReferrer();
045:
046: /**
047: * The domain name of the server that served the document, or
048: * <code>null</code> if the server cannot be identified by a domain name.
049: */
050: public String getDomain();
051:
052: /**
053: * The complete URI of the document.
054: */
055: public String getURL();
056:
057: /**
058: * The element that contains the content for the document. In documents
059: * with <code>BODY</code> contents, returns the <code>BODY</code>
060: * element. In frameset documents, this returns the outermost
061: * <code>FRAMESET</code> element.
062: */
063: public HTMLElement getBody();
064:
065: public void setBody(HTMLElement body);
066:
067: /**
068: * A collection of all the <code>IMG</code> elements in a document. The
069: * behavior is limited to <code>IMG</code> elements for backwards
070: * compatibility.
071: */
072: public HTMLCollection getImages();
073:
074: /**
075: * A collection of all the <code>OBJECT</code> elements that include
076: * applets and <code>APPLET</code> ( deprecated ) elements in a document.
077: */
078: public HTMLCollection getApplets();
079:
080: /**
081: * A collection of all <code>AREA</code> elements and anchor (
082: * <code>A</code> ) elements in a document with a value for the
083: * <code>href</code> attribute.
084: */
085: public HTMLCollection getLinks();
086:
087: /**
088: * A collection of all the forms of a document.
089: */
090: public HTMLCollection getForms();
091:
092: /**
093: * A collection of all the anchor (<code>A</code> ) elements in a document
094: * with a value for the <code>name</code> attribute. Note. For reasons
095: * of backwards compatibility, the returned set of anchors only contains
096: * those anchors created with the <code>name</code> attribute, not those
097: * created with the <code>id</code> attribute.
098: */
099: public HTMLCollection getAnchors();
100:
101: /**
102: * The cookies associated with this document. If there are none, the
103: * value is an empty string. Otherwise, the value is a string: a
104: * semicolon-delimited list of "name, value" pairs for all the cookies
105: * associated with the page. For example,
106: * <code>name=value;expires=date</code> .
107: */
108: public String getCookie();
109:
110: public void setCookie(String cookie);
111:
112: /**
113: * Note. This method and the ones following allow a user to add to or
114: * replace the structure model of a document using strings of unparsed
115: * HTML. At the time of writing alternate methods for providing similar
116: * functionality for both HTML and XML documents were being considered.
117: * The following methods may be deprecated at some point in the future in
118: * favor of a more general-purpose mechanism.
119: * <br> Open a document stream for writing. If a document exists in the
120: * target, this method clears it.
121: */
122: public void open();
123:
124: /**
125: * Closes a document stream opened by <code>open()</code> and forces
126: * rendering.
127: */
128: public void close();
129:
130: /**
131: * Write a string of text to a document stream opened by
132: * <code>open()</code> . The text is parsed into the document's structure
133: * model.
134: * @param text The string to be parsed into some structure in the
135: * document structure model.
136: */
137: public void write(String text);
138:
139: /**
140: * Write a string of text followed by a newline character to a document
141: * stream opened by <code>open()</code> . The text is parsed into the
142: * document's structure model.
143: * @param text The string to be parsed into some structure in the
144: * document structure model.
145: */
146: public void writeln(String text);
147:
148: /**
149: * Returns the (possibly empty) collection of elements whose
150: * <code>name</code> value is given by <code>elementName</code> .
151: * @param elementName The <code>name</code> attribute value for an
152: * element.
153: * @return The matching elements.
154: */
155: public NodeList getElementsByName(String elementName);
156:
157: }
|