public class OMElement extends OMNode
| Modifier | Constructor and Description |
|---|---|
protected |
OMElement(com.google.gwt.dom.client.Element element)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAttribute(String name)
Retrieves an attribute value by name.
|
OMAttr |
getAttributeNode(String attrName)
Retrieves an attribute node by name on the specified element.
|
String |
getAttributeNS(String namespaceURI,
String localName)
Retrieves an attribute value by local name and namespace URI.
|
OMNamedNodeMap<OMAttr> |
getAttributes()
Returns a
OMNamedNodeMap containing the attributes of the
specified element. |
com.google.gwt.dom.client.Element |
getElement()
Returns the wrapped Element
|
<T extends OMElement> |
getElementsByTagName(String name)
Returns a
OMNodeList of all descendant OMElements
with a given tag name, in document order. |
<T extends OMElement> |
getElementsByTagNameNS(String namespaceURI,
String localName)
Returns a
OMNodeList of all the descendant
OMElements with a given local name and namespace URI in
document order. |
String |
getId()
Returns the element id
|
String |
getTagName()
The name of the element.
|
boolean |
hasAttribute(String name)
Determines whether an element has an attribute with a given name.
|
boolean |
hasAttributeNS(String namespaceURI,
String localName)
Returns
true when an attribute with a given local name and
namespace URI is specified on the specified element or has a default value,
false otherwise. |
void |
removeAttribute(String name)
Removes an attribute by name.
|
void |
setAttribute(String name,
String value)
Adds a new attribute.
|
OMAttr |
setAttributeNode(OMAttr attr)
Adds a new attribute node to the specified element.
|
void |
setAttributeNS(String namespaceURI,
String localName,
String value)
Adds a new attribute to the specified element.
|
addDomHandler, addHandler, appendChild, cleanup, cloneNode, convert, convertList, dispatch, fireEvent, getChildNodes, getEventBus, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, normalize, removeChild, replaceChild, setNodeValue, toStringprotected OMElement(com.google.gwt.dom.client.Element element)
element - The wrapped elementpublic com.google.gwt.dom.client.Element getElement()
public final <T extends OMElement> OMNodeList<T> getElementsByTagName(String name)
OMNodeList of all descendant OMElements
with a given tag name, in document order.name - The name of the tag to match on. The special value "*"
matches all tags.OMElement nodes.public final <T extends OMElement> OMNodeList<T> getElementsByTagNameNS(String namespaceURI, String localName) throws com.google.gwt.core.client.JavaScriptException
OMNodeList of all the descendant
OMElements with a given local name and namespace URI in
document order.namespaceURI - The namespace URI of the elements to match on. The
special value "*" matches all namespaces.localName - The local name of the elements to match on. The
special value "*" matches all local names.OMNodeList object containing all the matched
OMElements.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not
support the feature "XML" and the language exposed
through the Document does not support XML Namespaces (such as [HTML 4.01]).com.google.gwt.core.client.JavaScriptExceptionpublic final String getId()
public final String getTagName()
Node.localName is different
from null, this attribute is a qualified name. For
example, in:
<elementExample id="demo"> ... </elementExample> ,
tagName has the value
"elementExample". Note that this is case-preserving in
XML, as are all of the operations of the DOM. The HTML DOM returns
the tagName of an HTML element in the canonical
uppercase form, regardless of the case in the source HTML document.public final boolean hasAttribute(String name)
Note that IE, prior to version 8, will return false-positives for names that collide with element properties (e.g., style, width, and so forth).
name - the name of the attributetrue if this element has the specified attributepublic final boolean hasAttributeNS(String namespaceURI, String localName) throws com.google.gwt.core.client.JavaScriptException
true when an attribute with a given local name and
namespace URI is specified on the specified element or has a default value,
false otherwise.
null as the
namespaceURI parameter for methods if they wish to have
no namespace.namespaceURI - The namespace URI of the attribute to look for.localName - The local name of the attribute to look for.true if an attribute with the given local name
and namespace URI is specified or has a default value on this
element, false otherwise.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not
support the feature "XML" and the language exposed
through the Document does not support XML Namespaces (such as [HTML 4.01]).com.google.gwt.core.client.JavaScriptExceptionpublic final String getAttribute(String name)
name - The name of the attribute to retrieve.OMAttr value as a string, or the empty string
if that attribute does not have a specified or default value.public final OMAttr getAttributeNode(String attrName)
getAttributeNodeNS method.attrName - The name (nodeName) of the attribute to
retrieve.OMAttr node with the specified name (
nodeName) or null if there is no such
attribute.public final String getAttributeNS(String namespaceURI, String localName) throws com.google.gwt.core.client.JavaScriptException
null as the
namespaceURI parameter for methods if they wish to have
no namespace.namespaceURI - The namespace URI of the attribute to retrieve.localName - The local name of the attribute to retrieve.OMAttr value as a string, or the empty string
if that attribute does not have a specified or default value.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not
support the feature "XML" and the language exposed
through the Document does not support XML Namespaces (such as [HTML 4.01]).com.google.gwt.core.client.JavaScriptExceptionpublic final OMNamedNodeMap<OMAttr> getAttributes()
OMNamedNodeMap containing the attributes of the
specified element.OMNamedNodeMap containing the attributes of the
specified elementpublic final void setAttribute(String name, String value) throws com.google.gwt.core.client.JavaScriptException
setAttributeNS method.name - The name of the attribute to create or alter.value - Value to set in string form.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
name according to the XML version in use specified in the
Document.xmlVersion attribute.
com.google.gwt.core.client.JavaScriptExceptionpublic final void setAttributeNS(String namespaceURI, String localName, String value) throws com.google.gwt.core.client.JavaScriptException
qualifiedName, and
its value is changed to be the value parameter. This
value is a simple string; it is not parsed as it is being set. So any
markup (such as syntax to be recognized as an entity reference) is
treated as literal text, and needs to be appropriately escaped by the
implementation when it is written out. In order to assign an
attribute value that contains entity references, the user must create
an OMAttr node plus any OMText and
EntityReference nodes, build the appropriate subtree,
and use setAttributeNodeNS or
setAttributeNode to assign it as the value of an
attribute.
null as the
namespaceURI parameter for methods if they wish to have
no namespace.namespaceURI - The namespace URI of the attribute to create or
alter.localName - The local name of the attribute to create or
alter.value - The value to set in string form.DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
an XML name according to the XML version in use specified in the
Document.xmlVersion attribute.
qualifiedName is
malformed per the Namespaces in XML specification, if the
qualifiedName has a prefix and the
namespaceURI is null, if the
qualifiedName has a prefix that is "xml" and the
namespaceURI is different from "
http://www.w3.org/XML/1998/namespace", if the qualifiedName or its prefix is "xmlns" and the
namespaceURI is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName nor its prefix is "xmlns".
"XML" and the language exposed
through the Document does not support XML Namespaces (such as [HTML 4.01]).com.google.gwt.core.client.JavaScriptExceptionpublic final OMAttr setAttributeNode(OMAttr attr) throws com.google.gwt.core.client.JavaScriptException
nodeName) is already present in the element, it is
replaced by the new one. Replacing an attribute node by itself has no
effect.
setAttributeNodeNS method.attr - The OMAttr node to add to the attribute list.attr attribute replaces an existing
attribute, the replaced OMAttr node is returned,
otherwise null is returned.DOMException - WRONG_DOCUMENT_ERR: Raised if attr was created from a
different document than the one that created the element.
attr is already an
attribute of another Element object. The DOM user must
explicitly clone OMAttr nodes to re-use them in other
elements.com.google.gwt.core.client.JavaScriptExceptionpublic final void removeAttribute(String name) throws com.google.gwt.core.client.JavaScriptException
OMDocument.normalizeDocument() to guarantee this
information is up-to-date.
removeAttributeNS method.name - The name of the attribute to remove.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.com.google.gwt.core.client.JavaScriptExceptionCopyright © 2018. All Rights Reserved.