Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/html/HTMLDocument.java
86410 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* This file is available under and governed by the GNU General Public26* License version 2 only, as published by the Free Software Foundation.27* However, the following notice accompanied the original version of this28* file and, per its terms, should not be removed:29*30* Copyright (c) 2000 World Wide Web Consortium,31* (Massachusetts Institute of Technology, Institut National de32* Recherche en Informatique et en Automatique, Keio University). All33* Rights Reserved. This program is distributed under the W3C's Software34* Intellectual Property License. This program is distributed in the35* hope that it will be useful, but WITHOUT ANY WARRANTY; without even36* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR37* PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more38* details.39*/4041package org.w3c.dom.html;4243import org.w3c.dom.Document;44import org.w3c.dom.NodeList;4546/**47* An <code>HTMLDocument</code> is the root of the HTML hierarchy and holds48* the entire content. Besides providing access to the hierarchy, it also49* provides some convenience methods for accessing certain sets of50* information from the document.51* <p> The following properties have been deprecated in favor of the52* corresponding ones for the <code>BODY</code> element: alinkColor background53* bgColor fgColor linkColor vlinkColor In DOM Level 2, the method54* <code>getElementById</code> is inherited from the <code>Document</code>55* interface where it was moved.56* <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>.57*/58public interface HTMLDocument extends Document {59/**60* The title of a document as specified by the <code>TITLE</code> element61* in the head of the document.62*/63public String getTitle();64public void setTitle(String title);6566/**67* Returns the URI of the page that linked to this page. The value is an68* empty string if the user navigated to the page directly (not through a69* link, but, for example, via a bookmark).70*/71public String getReferrer();7273/**74* The domain name of the server that served the document, or75* <code>null</code> if the server cannot be identified by a domain name.76*/77public String getDomain();7879/**80* The complete URI of the document.81*/82public String getURL();8384/**85* The element that contains the content for the document. In documents86* with <code>BODY</code> contents, returns the <code>BODY</code>87* element. In frameset documents, this returns the outermost88* <code>FRAMESET</code> element.89*/90public HTMLElement getBody();91public void setBody(HTMLElement body);9293/**94* A collection of all the <code>IMG</code> elements in a document. The95* behavior is limited to <code>IMG</code> elements for backwards96* compatibility.97*/98public HTMLCollection getImages();99100/**101* A collection of all the <code>OBJECT</code> elements that include102* applets and <code>APPLET</code> ( deprecated ) elements in a document.103*/104public HTMLCollection getApplets();105106/**107* A collection of all <code>AREA</code> elements and anchor (108* <code>A</code> ) elements in a document with a value for the109* <code>href</code> attribute.110*/111public HTMLCollection getLinks();112113/**114* A collection of all the forms of a document.115*/116public HTMLCollection getForms();117118/**119* A collection of all the anchor (<code>A</code> ) elements in a document120* with a value for the <code>name</code> attribute. Note. For reasons121* of backwards compatibility, the returned set of anchors only contains122* those anchors created with the <code>name</code> attribute, not those123* created with the <code>id</code> attribute.124*/125public HTMLCollection getAnchors();126127/**128* The cookies associated with this document. If there are none, the129* value is an empty string. Otherwise, the value is a string: a130* semicolon-delimited list of "name, value" pairs for all the cookies131* associated with the page. For example,132* <code>name=value;expires=date</code> .133*/134public String getCookie();135public void setCookie(String cookie);136137/**138* Note. This method and the ones following allow a user to add to or139* replace the structure model of a document using strings of unparsed140* HTML. At the time of writing alternate methods for providing similar141* functionality for both HTML and XML documents were being considered.142* The following methods may be deprecated at some point in the future in143* favor of a more general-purpose mechanism.144* <br> Open a document stream for writing. If a document exists in the145* target, this method clears it.146*/147public void open();148149/**150* Closes a document stream opened by <code>open()</code> and forces151* rendering.152*/153public void close();154155/**156* Write a string of text to a document stream opened by157* <code>open()</code> . The text is parsed into the document's structure158* model.159* @param text The string to be parsed into some structure in the160* document structure model.161*/162public void write(String text);163164/**165* Write a string of text followed by a newline character to a document166* stream opened by <code>open()</code> . The text is parsed into the167* document's structure model.168* @param text The string to be parsed into some structure in the169* document structure model.170*/171public void writeln(String text);172173/**174* Returns the (possibly empty) collection of elements whose175* <code>name</code> value is given by <code>elementName</code> .176* @param elementName The <code>name</code> attribute value for an177* element.178* @return The matching elements.179*/180public NodeList getElementsByName(String elementName);181182}183184185