org.apache.html.dom

Class HTMLDocumentImpl

Implemented Interfaces:
org.w3c.dom.events.DocumentEvent, org.w3c.dom.ranges.DocumentRange, org.w3c.dom.traversal.DocumentTraversal, org.w3c.dom.Document, org.w3c.dom.html.HTMLDocument

public class HTMLDocumentImpl
extends org.apache.xerces.dom.DocumentImpl
implements org.w3c.dom.html.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: 441883 $ $Date: 2006-09-09 20:38:58 -0400 (Sat, 09 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

org.w3c.dom.Node
cloneNode(boolean deep)
void
close()
org.w3c.dom.Attr
createAttribute(String name)
Creates an Attribute having this Document as its OwnerDoc.
org.w3c.dom.Element
createElement(String tagName)
org.w3c.dom.Element
createElementNS(String namespaceURI, String qualifiedName)
org.w3c.dom.Element
createElementNS(String namespaceURI, String qualifiedName, String localpart)
Xerces-specific constructor.
org.w3c.dom.html.HTMLCollection
getAnchors()
org.w3c.dom.html.HTMLCollection
getApplets()
org.w3c.dom.html.HTMLElement
getBody()
String
getCookie()
org.w3c.dom.Element
getDocumentElement()
String
getDomain()
org.w3c.dom.Element
getElementById(String elementId)
org.w3c.dom.NodeList
getElementsByName(String elementName)
org.w3c.dom.NodeList
getElementsByTagName(String tagName)
org.w3c.dom.NodeList
getElementsByTagNameNS(String namespaceURI, String localName)
org.w3c.dom.html.HTMLCollection
getForms()
org.w3c.dom.html.HTMLElement
getHead()
Obtains the <HEAD> element in the document, creating one if does not exist before.
org.w3c.dom.html.HTMLCollection
getImages()
org.w3c.dom.html.HTMLCollection
getLinks()
String
getReferrer()
String
getTitle()
String
getURL()
void
open()
void
setBody(org.w3c.dom.html.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 org.w3c.dom.Node cloneNode(boolean deep)
Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in interface org.apache.xerces.dom.DocumentImpl

close

public void close()
Specified by:
close in interface org.w3c.dom.html.HTMLDocument

createAttribute

public org.w3c.dom.Attr createAttribute(String name)
            throws org.w3c.dom.DOMException
Creates an Attribute having this Document as its OwnerDoc. Overrides DocumentImpl.createAttribute and returns and attribute whose name is lower case.
Specified by:
createAttribute in interface org.w3c.dom.Document
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 org.w3c.dom.Element createElement(String tagName)
            throws org.w3c.dom.DOMException
Specified by:
createElement in interface org.w3c.dom.Document
Overrides:
createElement in interface org.apache.xerces.dom.CoreDocumentImpl

createElementNS

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

createElementNS

public org.w3c.dom.Element createElementNS(String namespaceURI,
                                           String qualifiedName,
                                           String localpart)
            throws org.w3c.dom.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.
Returns:
Element A new Element object with the following attributes:
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

getAnchors

public org.w3c.dom.html.HTMLCollection getAnchors()
Specified by:
getAnchors in interface org.w3c.dom.html.HTMLDocument

getApplets

public org.w3c.dom.html.HTMLCollection getApplets()
Specified by:
getApplets in interface org.w3c.dom.html.HTMLDocument

getBody

public org.w3c.dom.html.HTMLElement getBody()
Specified by:
getBody in interface org.w3c.dom.html.HTMLDocument

getCookie

public String getCookie()
Specified by:
getCookie in interface org.w3c.dom.html.HTMLDocument

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Specified by:
getDocumentElement in interface org.w3c.dom.Document
Overrides:
getDocumentElement in interface org.apache.xerces.dom.CoreDocumentImpl

getDomain

public String getDomain()
Specified by:
getDomain in interface org.w3c.dom.html.HTMLDocument

getElementById

public org.w3c.dom.Element getElementById(String elementId)
Specified by:
getElementById in interface org.w3c.dom.html.HTMLDocument
getElementById in interface org.w3c.dom.Document
Overrides:
getElementById in interface org.apache.xerces.dom.CoreDocumentImpl

getElementsByName

public org.w3c.dom.NodeList getElementsByName(String elementName)
Specified by:
getElementsByName in interface org.w3c.dom.html.HTMLDocument

getElementsByTagName

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

getElementsByTagNameNS

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

getForms

public org.w3c.dom.html.HTMLCollection getForms()
Specified by:
getForms in interface org.w3c.dom.html.HTMLDocument

getHead

public org.w3c.dom.html.HTMLElement getHead()
Returns:
The <HEAD> element

getImages

public org.w3c.dom.html.HTMLCollection getImages()
Specified by:
getImages in interface org.w3c.dom.html.HTMLDocument

getLinks

public org.w3c.dom.html.HTMLCollection getLinks()
Specified by:
getLinks in interface org.w3c.dom.html.HTMLDocument

getReferrer

public String getReferrer()
Specified by:
getReferrer in interface org.w3c.dom.html.HTMLDocument

getTitle

public String getTitle()
Specified by:
getTitle in interface org.w3c.dom.html.HTMLDocument

getURL

public String getURL()
Specified by:
getURL in interface org.w3c.dom.html.HTMLDocument

open

public void open()
Specified by:
open in interface org.w3c.dom.html.HTMLDocument

setBody

public void setBody(org.w3c.dom.html.HTMLElement newBody)
Specified by:
setBody in interface org.w3c.dom.html.HTMLDocument

setCookie

public void setCookie(String cookie)
Specified by:
setCookie in interface org.w3c.dom.html.HTMLDocument

setTitle

public void setTitle(String newTitle)
Specified by:
setTitle in interface org.w3c.dom.html.HTMLDocument

write

public void write(String text)
Specified by:
write in interface org.w3c.dom.html.HTMLDocument

writeln

public void writeln(String text)
Specified by:
writeln in interface org.w3c.dom.html.HTMLDocument

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.