org.enhydra.xml.lazydom.html
Class LazyHTMLDocument

java.lang.Object
  |
  +--org.enhydra.apache.xerces.dom.NodeImpl
        |
        +--org.enhydra.apache.xerces.dom.ChildNode
              |
              +--org.enhydra.apache.xerces.dom.ParentNode
                    |
                    +--org.enhydra.apache.xerces.dom.CoreDocumentImpl
                          |
                          +--org.enhydra.apache.xerces.dom.DocumentImpl
                                |
                                +--org.enhydra.xml.lazydom.LazyDocument
                                      |
                                      +--org.enhydra.xml.lazydom.html.LazyHTMLDocument
All Implemented Interfaces:
Cloneable, Document, DocumentEvent, DocumentRange, DocumentTraversal, EventTarget, HTMLDocument, LazyNode, LazyParent, Node, NodeList, PreFormattedTextDocument, Serializable, XMLObjectLink

public class LazyHTMLDocument
extends LazyDocument
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 Node.appendChild(org.w3c.dom.Node) or Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node), 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(java.lang.String)) and HTTP attribute methods (getURL(), getCookie()).

Version:
$Revision: 1.4 $ $Date: 2005/01/26 08:29:24 $
Author:
Assaf Arkin
See Also:
HTMLDocument, Serialized Form

Inner classes inherited from class org.enhydra.apache.xerces.dom.DocumentImpl
org.enhydra.apache.xerces.dom.DocumentImpl.EnclosingAttr, org.enhydra.apache.xerces.dom.DocumentImpl.LEntry
 
Fields inherited from class org.enhydra.apache.xerces.dom.DocumentImpl
eventListeners, iterators, mutationEvents, ranges, savedEnclosingAttr, serialVersionUID, userData
 
Fields inherited from class org.enhydra.apache.xerces.dom.CoreDocumentImpl
allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, identifiers, kidOK, standalone, version
 
Fields inherited from class org.enhydra.apache.xerces.dom.ParentNode
fCachedChild, fCachedChildIndex, fCachedLength, firstChild, ownerDocument
 
Fields inherited from class org.enhydra.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.enhydra.apache.xerces.dom.NodeImpl
ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, UNNORMALIZED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.enhydra.xml.lazydom.LazyNode
DOCUMENT_NODE_ID, NULL_NODE_ID
 
Constructor Summary
LazyHTMLDocument()
          Constructor with no template.
LazyHTMLDocument(TemplateDOM templateDOM)
          LazyDOM: Constructor with TemplateDOM.
 
Method Summary
 Node cloneNode(boolean deep)
           
 void close()
           
 Attr createAttribute(String name)
          Creates an Attribute having this Document as its OwnerDoc.
 LazyElement createElement(int nodeId)
          Create a element from a template given its id.
 Element createElement(LazyElement template, String tagName)
           
 Element createElement(String tagName)
          LazyDOM: standard createElement method, passes null template element.
 Element createElementNS(String namespaceURI, String qualifiedName)
           
 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()
           
 DOMImplementation getImplementation()
           
 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.enhydra.xml.lazydom.LazyDocument
appendChild, appendChildWhileExpanding, areChildrenExpanded, createAttribute, createAttributeNS, createAttributeNS, createCDATASection, createCDATASection, createComment, createComment, createDocumentType, createDocumentType, createDocumentType, createEntity, createEntity, createEntityReference, createEntityReference, createNotation, createNotation, createProcessingInstruction, createProcessingInstruction, createTemplateAttribute, createTemplateAttributeNS, createTemplateCDATASection, createTemplateComment, createTemplateDocumentType, createTemplateElement, createTemplateElementNS, createTemplateEntity, createTemplateEntityReference, createTemplateNotation, createTemplateProcessingInstruction, createTemplateTextNode, createTextNode, createTextNode, doExpandChildren, doExpandParent, enterExpansion, getChildNodes, getDoctype, getExpandedNode, getFirstChild, getLastChild, getNodeById, getNodeFromTemplate, getNodeId, getPreFormatOutputOptions, getTemplateDocument, getTemplateNode, getTemplateNode, getXMLObject, hasChildNodes, insertBefore, isDocTypeExpanded, isParentExpanded, isTemplateNode, leaveExpansion, makeTemplateNode, normalize, removeChild, replaceChild, setChildrenExpanded, setNodeValue, setParentExpanded, setParentWhileExpanding, setPreFormatOutputOptions, setXMLObject, templateClone
 
Methods inherited from class org.enhydra.apache.xerces.dom.DocumentImpl
addEventListener, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, deletedText, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, getEventListeners, getMutationEvents, getUserData, insertedNode, insertedText, insertingNode, modifiedAttrValue, modifiedCharacterData, modifyingCharacterData, removedAttrNode, removedNode, removeEventListener, removeNodeIterator, removeRange, removingNode, replacedNode, replacedText, replacingNode, saveEnclosingAttr, setAttrNode, setEventListeners, setMutationEvents, setUserData, splitData
 
Methods inherited from class org.enhydra.apache.xerces.dom.CoreDocumentImpl
, adoptNode, changed, changes, clone, cloneNode, createDocumentFragment, createElementDefinition, getDocumentURI, getDomConfig, getEncoding, getErrorChecking, getIdentifier, getIdentifiers, getInputEncoding, getNodeName, getNodeType, getOwnerDocument, getStandalone, getStrictErrorChecking, getVersion, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, isKidOK, isXMLName, normalizeDocument, putIdentifier, removeIdentifier, renameNode, setDocumentURI, setEncoding, setErrorChecking, setStandalone, setStrictErrorChecking, setVersion, setXmlStandalone, setXmlVersion
 
Methods inherited from class org.enhydra.apache.xerces.dom.ParentNode
checkNormalizationAfterInsert, checkNormalizationAfterRemove, getChildNodesUnoptimized, getLength, internalInsertBefore, internalRemoveChild, item, lastChild, lastChild, ownerDocument, setOwnerDocument, setReadOnly, synchronizeChildren
 
Methods inherited from class org.enhydra.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling, parentNode, previousSibling
 
Methods inherited from class org.enhydra.apache.xerces.dom.NodeImpl
addEventListener, compareDocumentPosition, dispatchEvent, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getTextContent, getUserData, getUserData, hasAttributes, hasStringValue, hasStringValue, internalIsIgnorableWhitespace, isDefaultNamespace, isEqualNode, isFirstChild, isFirstChild, isIgnorableWhitespace, isNormalized, isNormalized, isOwned, isOwned, isReadOnly, isReadOnly, isSameNode, isSpecified, isSpecified, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, needsSyncChildren, needsSyncData, needsSyncData, removeEventListener, setPrefix, setTextContent, setUserData, setUserData, synchronizeData, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Document
adoptNode, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentURI, getDomConfig, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion
 
Methods inherited from interface org.w3c.dom.Node
appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Constructor Detail

LazyHTMLDocument

public LazyHTMLDocument()
Constructor with no template.

LazyHTMLDocument

public LazyHTMLDocument(TemplateDOM templateDOM)
LazyDOM: Constructor with TemplateDOM.
Method Detail

getImplementation

public DOMImplementation getImplementation()
Specified by:
getImplementation in interface Document
Overrides:
getImplementation in class LazyDocument
See Also:
Document.getImplementation()

getDocumentElement

public Element getDocumentElement()
Specified by:
getDocumentElement in interface Document
Overrides:
getDocumentElement in class LazyDocument
Following copied from class: org.enhydra.xml.lazydom.LazyDocument
See Also:
Document.getDocumentElement()

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 getDocumentElement(). If the element does not exist, one is created.

Called by getTitle(), setTitle(java.lang.String), getBody() and setBody(org.w3c.dom.html.HTMLElement) to assure the document has the <HEAD> element correctly placed.

Returns:
The <HEAD> element

getTitle

public String getTitle()
Specified by:
getTitle in interface HTMLDocument

setTitle

public void setTitle(String newTitle)
Specified by:
setTitle in interface HTMLDocument

getBody

public HTMLElement getBody()
Specified by:
getBody in interface HTMLDocument

setBody

public void setBody(HTMLElement newBody)
Specified by:
setBody in interface HTMLDocument

getElementById

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

getElementsByName

public NodeList getElementsByName(String elementName)
Specified by:
getElementsByName in interface HTMLDocument

getElementsByTagName

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

getElementsByTagNameNS

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

createElementNS

public Element createElementNS(String namespaceURI,
                               String qualifiedName)
Specified by:
createElementNS in interface Document
Overrides:
createElementNS in class LazyDocument
Following copied from class: org.enhydra.xml.lazydom.LazyDocument
See Also:
Document.createElementNS(java.lang.String, java.lang.String)

createElement

public Element createElement(LazyElement template,
                             String tagName)
                      throws DOMException

createAttribute

public Attr createAttribute(String name)
                     throws DOMException
Creates an Attribute having this Document as its OwnerDoc. Overrides CoreDocumentImpl.createAttribute(java.lang.String) and returns and attribute whose name is lower case.
Specified by:
createAttribute in interface Document
Overrides:
createAttribute in class LazyDocument
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

getReferrer

public String getReferrer()
Specified by:
getReferrer in interface HTMLDocument

getDomain

public String getDomain()
Specified by:
getDomain in interface HTMLDocument

getURL

public String getURL()
Specified by:
getURL in interface HTMLDocument

getCookie

public String getCookie()
Specified by:
getCookie in interface HTMLDocument

setCookie

public void setCookie(String cookie)
Specified by:
setCookie in interface HTMLDocument

getImages

public HTMLCollection getImages()
Specified by:
getImages in interface HTMLDocument

getApplets

public HTMLCollection getApplets()
Specified by:
getApplets in interface HTMLDocument

getLinks

public HTMLCollection getLinks()
Specified by:
getLinks in interface HTMLDocument

getForms

public HTMLCollection getForms()
Specified by:
getForms in interface HTMLDocument

getAnchors

public HTMLCollection getAnchors()
Specified by:
getAnchors in interface HTMLDocument

open

public void open()
Specified by:
open in interface HTMLDocument

close

public void close()
Specified by:
close in interface HTMLDocument

write

public void write(String text)
Specified by:
write in interface HTMLDocument

writeln

public void writeln(String text)
Specified by:
writeln in interface HTMLDocument

cloneNode

public Node cloneNode(boolean deep)
Specified by:
cloneNode in interface Node
Overrides:
cloneNode in class LazyDocument
Following copied from class: org.enhydra.xml.lazydom.LazyDocument
See Also:
Node.cloneNode(boolean)

createElement

public Element createElement(String tagName)
                      throws DOMException
LazyDOM: standard createElement method, passes null template element.
Specified by:
createElement in interface Document
Overrides:
createElement in class LazyDocument
Following copied from class: org.enhydra.xml.lazydom.LazyDocument
See Also:
Document.createElement(java.lang.String)

createElement

public LazyElement createElement(int nodeId)
                          throws DOMException
Description copied from class: LazyDocument
Create a element from a template given its id.
Overrides:
createElement in class LazyDocument
Following copied from class: org.enhydra.xml.lazydom.LazyDocument
See Also:
Document.createElement(java.lang.String)


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.