public class ElementOverNodeInfo extends NodeOverNodeInfo implements org.w3c.dom.Element
The class provides read-only access to the tree; methods that request updates all fail with an UnsupportedOperationException.
Note that contrary to the DOM specification, this implementation does not expose namespace declarations as attributes.
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
Constructor and Description |
---|
ElementOverNodeInfo() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttribute(java.lang.String name)
Retrieves an attribute value by name.
|
org.w3c.dom.Attr |
getAttributeNode(java.lang.String name)
Retrieves an attribute node by name.
|
org.w3c.dom.Attr |
getAttributeNodeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an
Attr node by local name and namespace URI. |
java.lang.String |
getAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an attribute value by local name and namespace URI.
|
org.w3c.dom.NodeList |
getElementsByTagName(java.lang.String name)
Returns a
NodeList of all descendant Elements
with a given tag name, in document order. |
org.w3c.dom.NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns a
NodeList of all the descendant
Elements with a given local name and namespace URI in
document order. |
org.w3c.dom.TypeInfo |
getSchemaTypeInfo()
Get the schema type information for this node.
|
java.lang.String |
getTagName()
The name of the element (DOM interface).
|
boolean |
hasAttribute(java.lang.String name)
Returns
true when an attribute with a given name is
specified on this element or has a default value, false
otherwise. |
boolean |
hasAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns
true when an attribute with a given local name
and namespace URI is specified on this element or has a default value,
false otherwise. |
void |
removeAttribute(java.lang.String oldAttr)
Removes the specified attribute.
|
org.w3c.dom.Attr |
removeAttributeNode(org.w3c.dom.Attr oldAttr)
Removes the specified attribute node.
|
void |
removeAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Removes an attribute by local name and namespace URI.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Adds a new attribute.
|
org.w3c.dom.Attr |
setAttributeNode(org.w3c.dom.Attr newAttr)
Adds a new attribute node.
|
org.w3c.dom.Attr |
setAttributeNodeNS(org.w3c.dom.Attr newAttr)
Add a new attribute.
|
void |
setAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
java.lang.String value)
Adds a new attribute.
|
void |
setIdAttribute(java.lang.String name,
boolean isId)
Mark an attribute as an ID.
|
void |
setIdAttributeNode(org.w3c.dom.Attr idAttr,
boolean isId)
Mark an attribute as an ID.
|
void |
setIdAttributeNS(java.lang.String namespaceURI,
java.lang.String localName,
boolean isId)
Mark an attribute as an ID.
|
appendChild, cloneNode, compareDocumentPosition, disallowUpdate, equals, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUnderlyingNodeInfo, getUserData, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData, wrap
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
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
public java.lang.String getTagName()
getTagName
in interface org.w3c.dom.Element
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
NodeList
of all descendant Elements
with a given tag name, in document order.getElementsByTagName
in interface org.w3c.dom.Element
name
- The name of the tag to match on. The special value "*"
matches all tags.Element
nodes.public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName) throws org.w3c.dom.DOMException
NodeList
of all the descendant
Elements
with a given local name and namespace URI in
document order.getElementsByTagNameNS
in interface org.w3c.dom.Element
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.NodeList
object containing all the matched
Elements
.org.w3c.dom.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]).public java.lang.String getAttribute(java.lang.String name)
getAttribute
in interface org.w3c.dom.Element
name
- The QName of the attribute to retrieve.Attr
value as a string, or the empty string if
that attribute does not have a specified or default value.public org.w3c.dom.Attr getAttributeNode(java.lang.String name)
getAttributeNodeNS
method.getAttributeNode
in interface org.w3c.dom.Element
name
- The name (nodeName
) of the attribute to
retrieve.Attr
node with the specified name (
nodeName
) or null
if there is no such
attribute.public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr) throws org.w3c.dom.DOMException
setAttributeNode
in interface org.w3c.dom.Element
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public void removeAttribute(java.lang.String oldAttr) throws org.w3c.dom.DOMException
removeAttribute
in interface org.w3c.dom.Element
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr) throws org.w3c.dom.DOMException
removeAttributeNode
in interface org.w3c.dom.Element
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
getAttributeNS
in interface org.w3c.dom.Element
namespaceURI
- The namespace URI of the attribute to retrieve.localName
- The local name of the attribute to retrieve.Attr
value as a string, or the empty string if
that attribute does not have a specified or default value.public void setAttribute(java.lang.String name, java.lang.String value) throws org.w3c.dom.DOMException
setAttribute
in interface org.w3c.dom.Element
name
- The name of the attribute to create or alter.value
- Value to set in string form.org.w3c.dom.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.
public void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value) throws org.w3c.dom.DOMException
setAttributeNS
in interface org.w3c.dom.Element
namespaceURI
- The namespace URI of the attribute to create or
alter.qualifiedName
- The qualified name of the attribute to create or
alter.value
- The value to set in string form.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName) throws org.w3c.dom.DOMException
removeAttributeNS
in interface org.w3c.dom.Element
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
Attr
node by local name and namespace URI.
This implementation does not expose namespace nodes as attributes.getAttributeNodeNS
in interface org.w3c.dom.Element
namespaceURI
- The namespace URI of the attribute to retrieve.localName
- The local name of the attribute to retrieve.Attr
node with the specified attribute local
name and namespace URI or null
if there is no such
attribute.public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr) throws org.w3c.dom.DOMException
setAttributeNodeNS
in interface org.w3c.dom.Element
newAttr
- The Attr
node to add to the attribute list.newAttr
attribute replaces an existing
attribute with the same local name and namespace URI , the
replaced Attr
node is returned, otherwise
null
is returned.org.w3c.dom.DOMException
- public boolean hasAttribute(java.lang.String name)
true
when an attribute with a given name is
specified on this element or has a default value, false
otherwise.
This implementation does not expose namespace nodes as attributes.hasAttribute
in interface org.w3c.dom.Element
name
- The name of the attribute to look for.true
if an attribute with the given name is
specified on this element or has a default value, false
otherwise.public boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
true
when an attribute with a given local name
and namespace URI is specified on this element or has a default value,
false
otherwise.
This implementation does not expose namespace nodes as attributes.hasAttributeNS
in interface org.w3c.dom.Element
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.public void setIdAttribute(java.lang.String name, boolean isId) throws java.lang.UnsupportedOperationException
setIdAttribute
in interface org.w3c.dom.Element
java.lang.UnsupportedOperationException
- alwayspublic void setIdAttributeNS(java.lang.String namespaceURI, java.lang.String localName, boolean isId) throws java.lang.UnsupportedOperationException
setIdAttributeNS
in interface org.w3c.dom.Element
java.lang.UnsupportedOperationException
- alwayspublic void setIdAttributeNode(org.w3c.dom.Attr idAttr, boolean isId) throws java.lang.UnsupportedOperationException
setIdAttributeNode
in interface org.w3c.dom.Element
java.lang.UnsupportedOperationException
- alwayspublic org.w3c.dom.TypeInfo getSchemaTypeInfo()
getSchemaTypeInfo
in interface org.w3c.dom.Element
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.