org.apache.html.dom

Class HTMLDocumentImpl

Implemented Interfaces:
Document, DocumentEvent, DocumentRange, DocumentTraversal, HTMLDocument

public class HTMLDocumentImpl
extends org.apache.xerces.dom.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 (open(), write(String)) and HTTP attribute methods (getURL(), getCookie()).

Version:
$Revision: 451609 $ $Date: 2006-09-30 12:20:57 -0400 (Sat, 30 Sep 2006) $
Author:
Assaf Arkin
See Also:
org.w3c.dom.html.HTMLDocument

Field Summary

Fields inherited from class org.apache.xerces.dom.DocumentImpl

eventListeners, iterators, mutationEvents, ranges

Fields inherited from class org.apache.xerces.dom.CoreDocumentImpl

actualEncoding, allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, fDocumentURI, identifiers, standalone, userData, version, xmlVersionChanged

Fields inherited from class org.apache.xerces.dom.ParentNode

fNodeListCache, firstChild, ownerDocument

Constructor Summary

HTMLDocumentImpl()

Method Summary

Node
cloneNode(boolean deep)
void
close()
Attr
createAttribute(String name)
Creates an Attribute having this Document as its OwnerDoc.
Element
createElement(String tagName)
Element
createElementNS(String namespaceURI, String qualifiedName)
Element
createElementNS(String namespaceURI, String qualifiedName, String localpart)
Xerces-specific constructor.
HTMLCollection
getAnchors()
HTMLCollection
getApplets()
HTMLElement
getBody()
String
getCookie()
Element
getDocumentElement()
String
getDomain()
Element
getElementById(String elementId)
NodeList
getElementsByName(String elementName)
NodeList
getElementsByTagName(String tagName)
NodeList
getElementsByTagNameNS(String namespaceURI, String localName)
HTMLCollection
getForms()
HTMLElement
getHead()
Obtains the <HEAD> element in the document, creating one if does not exist before.
HTMLCollection
getImages()
HTMLCollection
getLinks()
String
getReferrer()
String
getTitle()
String
getURL()
void
open()
void
setBody(HTMLElement newBody)
void
setCookie(String cookie)
void
setTitle(String newTitle)
void
write(String text)
void
writeln(String text)

Methods inherited from class org.apache.xerces.dom.DocumentImpl

addEventListener, cloneNode, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, dispatchingEventToSubtree, getEventListeners, getImplementation, removeEventListener, saveEnclosingAttr, setEventListeners

Methods inherited from class org.apache.xerces.dom.CoreDocumentImpl

abort, addEventListener, adoptNode, callUserDataHandlers, changed, changes, checkDOMNSErr, checkNamespaceWF, checkQName, clearIdentifiers, clone, cloneNode, cloneNode, copyEventListeners, createAttribute, createAttributeNS, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElement, createElementDefinition, createElementNS, createElementNS, createEntity, createEntityReference, createNotation, createProcessingInstruction, createTextNode, dispatchEvent, getAsync, getBaseURI, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getEncoding, getErrorChecking, getFeature, getIdentifier, getIdentifiers, getImplementation, getInputEncoding, getNodeName, getNodeNumber, getNodeNumber, getNodeType, getOwnerDocument, getStandalone, getStrictErrorChecking, getTextContent, getUserData, getUserData, getUserDataRecord, getVersion, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, insertBefore, isKidOK, isValidQName, isXMLName, load, loadXML, normalizeDocument, putIdentifier, removeChild, removeEventListener, removeIdentifier, renameNode, replaceChild, saveXML, setAsync, setDocumentURI, setEncoding, setErrorChecking, setInputEncoding, setStandalone, setStrictErrorChecking, setTextContent, setUserData, setUserData, setVersion, setXmlEncoding, setXmlStandalone, setXmlVersion, undeferChildren

Methods inherited from class org.apache.xerces.dom.ParentNode

cloneNode, getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, isEqualNode, item, normalize, removeChild, replaceChild, setOwnerDocument, setReadOnly, setTextContent, synchronizeChildren

Constructor Details

HTMLDocumentImpl

public HTMLDocumentImpl()

Method Details

cloneNode

public Node cloneNode(boolean deep)
Overrides:
cloneNode in interface org.apache.xerces.dom.DocumentImpl

close

public void close()

createAttribute

public Attr createAttribute(String name)
            throws DOMException
Creates an Attribute having this Document as its OwnerDoc. Overrides DocumentImpl.createAttribute and returns and attribute whose name is lower case.
Overrides:
createAttribute in interface org.apache.xerces.dom.CoreDocumentImpl
Parameters:
name - The name of the attribute
Returns:
An attribute whose name is all lower case

createElement

public Element createElement(String tagName)
            throws DOMException
Overrides:
createElement in interface org.apache.xerces.dom.CoreDocumentImpl

createElementNS

public Element createElementNS(String namespaceURI,
                               String qualifiedName)
Overrides:
createElementNS in interface org.apache.xerces.dom.CoreDocumentImpl

createElementNS

public Element createElementNS(String namespaceURI,
                               String qualifiedName,
                               String localpart)
            throws DOMException
Xerces-specific constructor. "localName" is passed in, so we don't need to create a new String for it.
Overrides:
createElementNS in interface org.apache.xerces.dom.CoreDocumentImpl
Parameters:
namespaceURI - The namespace URI of the element to create.
qualifiedName - The qualified name of the element type to instantiate.
localpart - The local name of the element to instantiate.
Returns:
Element A new Element object with the following attributes:

getAnchors

public HTMLCollection getAnchors()

getApplets

public HTMLCollection getApplets()

getBody

public HTMLElement getBody()

getCookie

public String getCookie()

getDocumentElement

public Element getDocumentElement()
Overrides:
getDocumentElement in interface org.apache.xerces.dom.CoreDocumentImpl

getDomain

public String getDomain()

getElementById

public Element getElementById(String elementId)
Overrides:
getElementById in interface org.apache.xerces.dom.CoreDocumentImpl

getElementsByName

public NodeList getElementsByName(String elementName)

getElementsByTagName

public final NodeList getElementsByTagName(String tagName)
Overrides:
getElementsByTagName in interface org.apache.xerces.dom.CoreDocumentImpl

getElementsByTagNameNS

public final NodeList getElementsByTagNameNS(String namespaceURI,
                                             String localName)
Overrides:
getElementsByTagNameNS in interface org.apache.xerces.dom.CoreDocumentImpl

getForms

public HTMLCollection getForms()

getHead

public HTMLElement getHead()
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-2007 The Apache Software Foundation. All Rights Reserved.