org.enhydra.xml.lazydom.html
Class LazyHTMLElement

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.ElementImpl
                          |
                          +--org.enhydra.xml.lazydom.LazyElementNoNS
                                |
                                +--org.enhydra.xml.lazydom.html.LazyHTMLElement
All Implemented Interfaces:
java.lang.Cloneable, org.w3c.dom.Element, org.w3c.dom.events.EventTarget, org.w3c.dom.html.HTMLElement, LazyElement, LazyNode, LazyParent, org.w3c.dom.Node, org.w3c.dom.NodeList, PreFormattedText, java.io.Serializable
Direct Known Subclasses:
HTMLAnchorElementImpl, HTMLAppletElementImpl, HTMLAreaElementImpl, HTMLBaseElementImpl, HTMLBaseFontElementImpl, HTMLBodyElementImpl, HTMLBRElementImpl, HTMLButtonElementImpl, HTMLDirectoryElementImpl, HTMLDivElementImpl, HTMLDListElementImpl, HTMLFieldSetElementImpl, HTMLFontElementImpl, HTMLFormElementImpl, HTMLFrameElementImpl, HTMLFrameSetElementImpl, HTMLHeadElementImpl, HTMLHeadingElementImpl, HTMLHRElementImpl, HTMLHtmlElementImpl, HTMLIFrameElementImpl, HTMLImageElementImpl, HTMLInputElementImpl, HTMLIsIndexElementImpl, HTMLLabelElementImpl, HTMLLegendElementImpl, HTMLLIElementImpl, HTMLLinkElementImpl, HTMLMapElementImpl, HTMLMenuElementImpl, HTMLMetaElementImpl, HTMLModElementImpl, HTMLObjectElementImpl, HTMLOListElementImpl, HTMLOptGroupElementImpl, HTMLOptionElementImpl, HTMLParagraphElementImpl, HTMLParamElementImpl, HTMLPreElementImpl, HTMLQuoteElementImpl, HTMLScriptElementImpl, HTMLSelectElementImpl, HTMLStyleElementImpl, HTMLTableCaptionElementImpl, HTMLTableCellElementImpl, HTMLTableColElementImpl, HTMLTableElementImpl, HTMLTableRowElementImpl, HTMLTableSectionElementImpl, HTMLTextAreaElementImpl, HTMLTitleElementImpl, HTMLUListElementImpl

public class LazyHTMLElement
extends LazyElementNoNS
implements org.w3c.dom.html.HTMLElement

Implements an HTML-specific element, an Element that will only appear inside HTML documents. This element extends ElementImpl by adding methods for directly manipulating HTML-specific attributes. All HTML elements gain access to the id, title, lang, dir and class attributes. Other elements add their own specific attributes.

Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/10 16:36:19 $
Author:
Assaf Arkin
See Also:
HTMLElement, Serialized Form

Field Summary
 
Fields inherited from class org.enhydra.apache.xerces.dom.ElementImpl
attributes, name
 
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_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
(package private) LazyHTMLElement(LazyHTMLDocument owner, LazyElement template, java.lang.String tagName)
          Constructor required owner document and element tag name.
 
Method Summary
(package private)  java.lang.String capitalize(java.lang.String value)
          Convenience method used to capitalize a one-off attribute value before it is returned.
 java.lang.String getAttribute(java.lang.String attrName)
           
 org.w3c.dom.Attr getAttributeNode(java.lang.String attrName)
           
 org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
(package private)  boolean getBinary(java.lang.String name)
          Convenience method used to translate an attribute value into a boolean value.
(package private)  java.lang.String getCapitalized(java.lang.String name)
          Convenience method used to capitalize a one-off attribute value before it is returned.
 java.lang.String getClassName()
           
 java.lang.String getDir()
           
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
           
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
           
 org.w3c.dom.html.HTMLFormElement getForm()
          Convenience method returns the form in which this form element is contained.
 java.lang.String getId()
           
(package private)  int getInteger(java.lang.String value)
          Convenience method used to translate an attribute value into an integer value.
 java.lang.String getLang()
           
 java.lang.String getTitle()
           
(package private)  void setAttribute(java.lang.String name, boolean value)
          Convenience method used to set a boolean attribute.
 void setClassName(java.lang.String className)
           
 void setDir(java.lang.String dir)
           
 void setId(java.lang.String id)
           
 void setLang(java.lang.String lang)
           
 void setTitle(java.lang.String title)
           
 
Methods inherited from class org.enhydra.xml.lazydom.LazyElementNoNS
appendChild, appendChildWhileExpanding, areAttributesExpanded, areChildrenExpanded, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeId, getParentNode, getPreFormattedText, getPreviousSibling, getTemplateElement, getTemplateNode, hasChildNodes, insertBefore, isParentExpanded, isTemplateNode, makeTemplateNode, makeTemplateNode, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setChildrenExpanded, setNodeValue, setParentExpanded, setParentWhileExpanding, setPreFormattedText, templateClone
 
Methods inherited from class org.enhydra.apache.xerces.dom.ElementImpl
getDefaultAttributes, getNodeName, getNodeType, getTagName, hasAttribute, hasAttributeNS, hasAttributes, reconcileDefaultAttributes, setReadOnly, setupDefaultAttributes, synchronizeData
 
Methods inherited from class org.enhydra.apache.xerces.dom.ParentNode
getChildNodesUnoptimized, getLength, getOwnerDocument, item, synchronizeChildren
 
Methods inherited from class org.enhydra.apache.xerces.dom.ChildNode
 
Methods inherited from class org.enhydra.apache.xerces.dom.NodeImpl
addEventListener, changed, changes, dispatchEvent, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, isSupported, removeEventListener, setPrefix, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Element
getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Constructor Detail

LazyHTMLElement

LazyHTMLElement(LazyHTMLDocument owner,
                LazyElement template,
                java.lang.String tagName)
Constructor required owner document and element tag name. Will be called by the constructor of specific element types but with a known tag name. Assures that the owner document is an HTML element.

Parameters:
owner - The owner HTML document
template - If not null, then this template will be used to initialize the Element.
tagName - The element's tag name
Method Detail

getId

public java.lang.String getId()
Specified by:
getId in interface org.w3c.dom.html.HTMLElement

setId

public void setId(java.lang.String id)
Specified by:
setId in interface org.w3c.dom.html.HTMLElement

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface org.w3c.dom.html.HTMLElement

setTitle

public void setTitle(java.lang.String title)
Specified by:
setTitle in interface org.w3c.dom.html.HTMLElement

getLang

public java.lang.String getLang()
Specified by:
getLang in interface org.w3c.dom.html.HTMLElement

setLang

public void setLang(java.lang.String lang)
Specified by:
setLang in interface org.w3c.dom.html.HTMLElement

getDir

public java.lang.String getDir()
Specified by:
getDir in interface org.w3c.dom.html.HTMLElement

setDir

public void setDir(java.lang.String dir)
Specified by:
setDir in interface org.w3c.dom.html.HTMLElement

getClassName

public java.lang.String getClassName()
Specified by:
getClassName in interface org.w3c.dom.html.HTMLElement

setClassName

public void setClassName(java.lang.String className)
Specified by:
setClassName in interface org.w3c.dom.html.HTMLElement

getInteger

int getInteger(java.lang.String value)
Convenience method used to translate an attribute value into an integer value. Returns the integer value or zero if the attribute is not a valid numeric string.

Parameters:
value - The value of the attribute
Returns:
The integer value, or zero if not a valid numeric string

getBinary

boolean getBinary(java.lang.String name)
Convenience method used to translate an attribute value into a boolean value. If the attribute has an associated value (even an empty string), it is set and true is returned. If the attribute does not exist, false is returend.

Returns:
True or false depending on whether the attribute has been set

setAttribute

void setAttribute(java.lang.String name,
                  boolean value)
Convenience method used to set a boolean attribute. If the value is true, the attribute is set to an empty string. If the value is false, the attribute is removed. HTML 4.0 understands empty strings as set attributes.

Parameters:
name - The name of the attribute
value - The value of the attribute

getAttributeNode

public org.w3c.dom.Attr getAttributeNode(java.lang.String attrName)
Specified by:
getAttributeNode in interface org.w3c.dom.Element
Overrides:
getAttributeNode in class LazyElementNoNS
See Also:
Element.getAttributeNode(java.lang.String)

getAttributeNodeNS

public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI,
                                           java.lang.String localName)
Specified by:
getAttributeNodeNS in interface org.w3c.dom.Element
Overrides:
getAttributeNodeNS in class LazyElementNoNS
See Also:
Element.getAttributeNodeNS(java.lang.String, java.lang.String)

getAttribute

public java.lang.String getAttribute(java.lang.String attrName)
Specified by:
getAttribute in interface org.w3c.dom.Element
Overrides:
getAttribute in class LazyElementNoNS
See Also:
Element.getAttribute(java.lang.String)

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
Specified by:
getAttributeNS in interface org.w3c.dom.Element
Overrides:
getAttributeNS in class LazyElementNoNS
See Also:
Element.getAttributeNS(java.lang.String, java.lang.String)

getElementsByTagName

public final org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
Specified by:
getElementsByTagName in interface org.w3c.dom.Element
Overrides:
getElementsByTagName in class org.enhydra.apache.xerces.dom.ElementImpl

getElementsByTagNameNS

public final org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                         java.lang.String localName)
Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Element
Overrides:
getElementsByTagNameNS in class org.enhydra.apache.xerces.dom.ElementImpl

capitalize

java.lang.String capitalize(java.lang.String value)
Convenience method used to capitalize a one-off attribute value before it is returned. For example, the align values "LEFT" and "left" will both return as "Left".

Parameters:
value - The value of the attribute
Returns:
The capitalized value

getCapitalized

java.lang.String getCapitalized(java.lang.String name)
Convenience method used to capitalize a one-off attribute value before it is returned. For example, the align values "LEFT" and "left" will both return as "Left".

Parameters:
name - The name of the attribute
Returns:
The capitalized value

getForm

public org.w3c.dom.html.HTMLFormElement getForm()
Convenience method returns the form in which this form element is contained. This method is exposed for form elements through the DOM API, but other elements have no access to it through the API.



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