org.apache.html.dom

Class HTMLDocumentImpl

public class HTMLDocumentImpl extends DocumentImpl implements HTMLDocument

Implements an HTML document. Provides access to the top level element in the document, its body and title.

Several methods create new nodes of all basic types (comment, text, element, etc.). These methods create new nodes but do not place them in the document tree. The nodes may be placed in the document tree using org.w3c.dom.Node#appendChild or org.w3c.dom.Node#insertBefore, or they may be placed in some other document tree.

Note: <FRAMESET> documents are not supported at the moment, neither are direct document writing (HTMLDocumentImpl, HTMLDocumentImpl) and HTTP attribute methods (HTMLDocumentImpl, HTMLDocumentImpl).

INTERNAL:

Usage of this class is not supported. It may be altered or removed at any time.

Version: $Revision: 1.21 $ $Date: 2005/04/18 00:41:07 $

Author: Assaf Arkin

See Also: org.w3c.dom.html.HTMLDocument

Constructor Summary
HTMLDocumentImpl()
Method Summary
NodecloneNode(boolean deep)
voidclose()
AttrcreateAttribute(String name)
Creates an Attribute having this Document as its OwnerDoc.
ElementcreateElement(String tagName)
ElementcreateElementNS(String namespaceURI, String qualifiedName, String localpart)
Xerces-specific constructor.
ElementcreateElementNS(String namespaceURI, String qualifiedName)
HTMLCollectiongetAnchors()
HTMLCollectiongetApplets()
HTMLElementgetBody()
StringgetCookie()
ElementgetDocumentElement()
StringgetDomain()
ElementgetElementById(String elementId)
NodeListgetElementsByName(String elementName)
NodeListgetElementsByTagName(String tagName)
NodeListgetElementsByTagNameNS(String namespaceURI, String localName)
HTMLCollectiongetForms()
HTMLElementgetHead()
Obtains the <HEAD> element in the document, creating one if does not exist before.
HTMLCollectiongetImages()
HTMLCollectiongetLinks()
StringgetReferrer()
StringgetTitle()
StringgetURL()
voidopen()
voidsetBody(HTMLElement newBody)
voidsetCookie(String cookie)
voidsetTitle(String newTitle)
voidwrite(String text)
voidwriteln(String text)

Constructor Detail

HTMLDocumentImpl

public HTMLDocumentImpl()

Method Detail

cloneNode

public Node cloneNode(boolean deep)

close

public void close()

createAttribute

public Attr createAttribute(String name)
Creates an Attribute having this Document as its OwnerDoc. Overrides DocumentImpl#createAttribute and returns and attribute whose name is lower case.

Parameters: name The name of the attribute

Returns: An attribute whose name is all lower case

Throws: DOMException(INVALID_NAME_ERR) if the attribute name is not acceptable

createElement

public Element createElement(String tagName)

createElementNS

public Element createElementNS(String namespaceURI, String qualifiedName, String localpart)
Xerces-specific constructor. "localName" is passed in, so we don't need to create a new String for it.

Parameters: namespaceURI The namespace URI of the element to create. qualifiedName The qualified name of the element type to instantiate. localName The local name of the element to instantiate.

Returns: Element A new Element object with the following attributes:

Throws: DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createElementNS

public Element createElementNS(String namespaceURI, String qualifiedName)

getAnchors

public HTMLCollection getAnchors()

getApplets

public HTMLCollection getApplets()

getBody

public HTMLElement getBody()

getCookie

public String getCookie()

getDocumentElement

public Element getDocumentElement()

getDomain

public String getDomain()

getElementById

public Element getElementById(String elementId)

getElementsByName

public NodeList getElementsByName(String elementName)

getElementsByTagName

public final NodeList getElementsByTagName(String tagName)

getElementsByTagNameNS

public final NodeList getElementsByTagNameNS(String namespaceURI, String localName)

getForms

public HTMLCollection getForms()

getHead

public HTMLElement getHead()
Obtains the <HEAD> element in the document, creating one if does not exist before. The <HEAD> element is the first element in the <HTML> in the document. The <HTML> element is obtained by calling HTMLDocumentImpl. If the element does not exist, one is created.

Called by HTMLDocumentImpl, HTMLDocumentImpl, HTMLDocumentImpl and HTMLDocumentImpl to assure the document has the <HEAD> element correctly placed.

Returns: The <HEAD> element

getImages

public HTMLCollection getImages()

getLinks

public HTMLCollection getLinks()

getReferrer

public String getReferrer()

getTitle

public String getTitle()

getURL

public String getURL()

open

public void open()

setBody

public void setBody(HTMLElement newBody)

setCookie

public void setCookie(String cookie)

setTitle

public void setTitle(String newTitle)

write

public void write(String text)

writeln

public void writeln(String text)
Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.