Class HTMLElementImpl
java.lang.Object
org.htmlunit.cyberneko.xerces.dom.NodeImpl
org.htmlunit.cyberneko.xerces.dom.ChildNode
org.htmlunit.cyberneko.xerces.dom.ParentNode
org.htmlunit.cyberneko.xerces.dom.ElementImpl
org.htmlunit.cyberneko.html.dom.HTMLElementImpl
- All Implemented Interfaces:
Cloneable, Element, EventTarget, org.w3c.dom.html.HTMLElement, Node, NodeList, TypeInfo
- 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
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.
- See Also:
-
Field Summary
Fields inherited from class ElementImpl
attributes_, name_Fields inherited from class ParentNode
firstChild, fNodeListCache, ownerDocumentFields inherited from class ChildNode
nextSibling_, previousSibling_Fields inherited from class NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, FIRSTCHILD, HASSTRING, ID, NORMALIZED, OWNED, ownerNode_, READONLY, SPECIFIED, SYNCCHILDRENFields inherited from interface 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_NODEFields inherited from interface TypeInfo
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION -
Constructor Summary
ConstructorsConstructorDescriptionHTMLElementImpl(HTMLDocumentImpl owner, String tagName) Constructor required owner document and element tag name. -
Method Summary
Modifier and TypeMethodDescription(package private) Stringcapitalize(String value) Convenience method used to capitalize a one-off attribute value before it is returned.getAttribute(String attrName) Look up a single Attribute by name.getAttributeNode(String attrName) Look up a single Attribute by name.getAttributeNodeNS(String namespaceURI, String localName) Retrieves an Attr node by local name and namespace URI.getAttributeNS(String namespaceURI, String localName) Introduced in DOM Level 2.(package private) booleanConvenience method used to translate an attribute value into a boolean value.(package private) StringgetCapitalized(String attrname) Convenience method used to capitalize a one-off attribute value before it is returned.getDir()final NodeListgetElementsByTagName(String tagName) Returns a NodeList of all descendent nodes (children, grandchildren, and so on) which are Elements and which have the specified tag name.final NodeListgetElementsByTagNameNS(String namespaceURI, String localName) Introduced in DOM Level 2.org.w3c.dom.html.HTMLFormElementgetForm()Convenience method returns the form in which this form element is contained.getId()(package private) intgetInteger(String value) Convenience method used to translate an attribute value into an integer value.getLang()getTitle()(package private) voidsetAttribute(String name, boolean value) Convenience method used to set a boolean attribute.voidsetClassName(String classname) voidvoidvoidvoidMethods inherited from class ElementImpl
cloneNode, getAttributes, getBaseURI, getNodeName, getNodeType, getSchemaTypeInfo, getTagName, getTypeName, getTypeNamespace, getXMLBaseAttribute, hasAttribute, hasAttributeNS, hasAttributes, isDerivedFrom, isEqualNode, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setOwnerDocumentMethods inherited from class ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, item, removeChild, replaceChild, setTextContent, synchronizeChildrenMethods inherited from class ChildNode
getNextSibling, getParentNode, getPreviousSiblingMethods inherited from class NodeImpl
addEventListener, appendChild, changed, changes, compareDocumentPosition, dispatchEvent, getFeature, getLocalName, getNamespaceURI, getNodeNumber, getNodeValue, getPrefix, getUserData, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, normalize, removeEventListener, setNodeValue, setPrefix, setUserData, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Element
getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNSMethods inherited from interface Node
appendChild, cloneNode, 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 Details
-
HTMLElementImpl
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 documenttagName- The element's tag name
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceorg.w3c.dom.html.HTMLElement
-
setId
- Specified by:
setIdin interfaceorg.w3c.dom.html.HTMLElement
-
getTitle
- Specified by:
getTitlein interfaceorg.w3c.dom.html.HTMLElement
-
setTitle
- Specified by:
setTitlein interfaceorg.w3c.dom.html.HTMLElement
-
getLang
- Specified by:
getLangin interfaceorg.w3c.dom.html.HTMLElement
-
setLang
- Specified by:
setLangin interfaceorg.w3c.dom.html.HTMLElement
-
getDir
- Specified by:
getDirin interfaceorg.w3c.dom.html.HTMLElement
-
setDir
- Specified by:
setDirin interfaceorg.w3c.dom.html.HTMLElement
-
getClassName
- Specified by:
getClassNamein interfaceorg.w3c.dom.html.HTMLElement
-
setClassName
- Specified by:
setClassNamein interfaceorg.w3c.dom.html.HTMLElement
-
getInteger
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
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 returned.- Parameters:
attrName- The name of the attribute- Returns:
- True or false depending on whether the attribute has been set
-
setAttribute
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 attributevalue- The value of the attribute
-
getAttributeNode
Description copied from class:ElementImplLook up a single Attribute by name. Returns the Attribute Node, so its complete child tree is available. This could be important in XML, where the string rendering may not be sufficient information.If no matching attribute is available, returns null.
- Specified by:
getAttributeNodein interfaceElement- Overrides:
getAttributeNodein classElementImpl
-
getAttributeNodeNS
Description copied from class:ElementImplRetrieves an Attr node by local name and namespace URI.- Specified by:
getAttributeNodeNSin interfaceElement- Overrides:
getAttributeNodeNSin classElementImpl- Parameters:
namespaceURI- The namespace URI of the attribute to retrieve.localName- The local name of the attribute to retrieve.- Returns:
- Attr The Attr node with the specified attribute local name and namespace URI or null if there is no such attribute.
-
getAttribute
Description copied from class:ElementImplLook up a single Attribute by name. Returns the Attribute's string value, or an empty string (NOT null!) to indicate that the name did not map to a currently defined attribute.Note: Attributes may contain complex node trees. This method returns the "flattened" string obtained from Attribute.getValue(). If you need the structure information, see getAttributeNode().
- Specified by:
getAttributein interfaceElement- Overrides:
getAttributein classElementImpl
-
getAttributeNS
Description copied from class:ElementImplIntroduced in DOM Level 2.Retrieves an attribute value by local name and namespace URI.
- Specified by:
getAttributeNSin interfaceElement- Overrides:
getAttributeNSin classElementImpl- Parameters:
namespaceURI- The namespace URI of the attribute to retrieve.localName- The local name of the attribute to retrieve.- Returns:
- String The Attr value as a string, or empty string if that attribute does not have a specified or default value.
-
getElementsByTagName
Description copied from class:ElementImplReturns a NodeList of all descendent nodes (children, grandchildren, and so on) which are Elements and which have the specified tag name.Note: NodeList is a "live" view of the DOM. Its contents will change as the DOM changes, and alterations made to the NodeList will be reflected in the DOM.
- Specified by:
getElementsByTagNamein interfaceElement- Overrides:
getElementsByTagNamein classElementImpl- Parameters:
tagName- The type of element to gather. To obtain a list of all elements no matter what their names, use the wild-card tag name "*".- See Also:
-
getElementsByTagNameNS
Description copied from class:ElementImplIntroduced in DOM Level 2.Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they would be encountered in a preorder traversal of the Document tree, starting from this node.
- Specified by:
getElementsByTagNameNSin interfaceElement- Overrides:
getElementsByTagNameNSin classElementImpl- Parameters:
namespaceURI- The namespace URI of the elements to match on. The special value "*" matches all namespaces. When it is null or an empty string, this method behaves like getElementsByTagName.localName- The local name of the elements to match on. The special value "*" matches all local names.- Returns:
- NodeList A new NodeList object containing all the matched Elements.
-
capitalize
-
getCapitalized
-
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.
-