public class AttrImpl extends NodeImpl implements org.w3c.dom.Attr
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 |
---|
AttrImpl()
Default Constructor
|
AttrImpl(org.w3c.dom.Element element,
java.lang.String prefix,
java.lang.String localpart,
java.lang.String rawname,
java.lang.String uri,
java.lang.String value)
Constructs an attribute.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Returns the name of this attribute.
|
java.lang.String |
getNodeValue()
The value of this node, depending on its type; see the table above.
|
org.w3c.dom.Document |
getOwnerDocument()
The
Document object associated with this node. |
org.w3c.dom.Element |
getOwnerElement()
The
Element node this attribute is attached to or
null if this attribute is not in use. |
org.w3c.dom.TypeInfo |
getSchemaTypeInfo()
Method getSchemaTypeInfo.
|
boolean |
getSpecified()
True if this attribute was explicitly given a value in
the instance document, false otherwise. |
java.lang.String |
getValue()
On retrieval, the value of the attribute is returned as a string.
|
boolean |
isId()
Returns whether this attribute is known to be of type ID (i.e.
|
void |
setValue(java.lang.String value)
On retrieval, the value of the attribute is returned as a string.
|
java.lang.String |
toString()
NON-DOM method for debugging convenience
|
getLocalName, getNamespaceURI, getNodeName, getNodeType, getPrefix, getReadOnly, setReadOnly
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getParentNode, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
public AttrImpl()
public AttrImpl(org.w3c.dom.Element element, java.lang.String prefix, java.lang.String localpart, java.lang.String rawname, java.lang.String uri, java.lang.String value)
element
- Element which owns this attributeprefix
- The QName prefix.localpart
- The QName localpart.rawname
- The QName rawname.uri
- The uri binding for the associated prefix.value
- The value of the attribute.public java.lang.String getName()
org.w3c.dom.Attr
Node.localName
is
different from null
, this attribute is a qualified name.getName
in interface org.w3c.dom.Attr
public boolean getSpecified()
org.w3c.dom.Attr
True
if this attribute was explicitly given a value in
the instance document, false
otherwise. If the
application changed the value of this attribute node (even if it ends
up having the same value as the default value) then it is set to
true
. The implementation may handle attributes with
default values from other schemas similarly but applications should
use Document.normalizeDocument()
to guarantee this
information is up-to-date.getSpecified
in interface org.w3c.dom.Attr
public java.lang.String getValue()
org.w3c.dom.Attr
getAttribute
on the
Element
interface.
Text
node with the unparsed
contents of the string, i.e. any characters that an XML processor
would recognize as markup are instead treated as literal text. See
also the method Element.setAttribute()
.
getValue
in interface org.w3c.dom.Attr
public java.lang.String getNodeValue()
org.w3c.dom.Node
null
, setting it has no effect,
including if the node is read-only.getNodeValue
in interface org.w3c.dom.Node
getNodeValue
in class DefaultNode
public org.w3c.dom.Element getOwnerElement()
org.w3c.dom.Attr
Element
node this attribute is attached to or
null
if this attribute is not in use.getOwnerElement
in interface org.w3c.dom.Attr
public org.w3c.dom.Document getOwnerDocument()
org.w3c.dom.Node
Document
object associated with this node. This is
also the Document
object used to create new nodes. When
this node is a Document
or a DocumentType
which is not used with any Document
yet, this is
null
.getOwnerDocument
in interface org.w3c.dom.Node
getOwnerDocument
in class DefaultNode
public void setValue(java.lang.String value) throws org.w3c.dom.DOMException
org.w3c.dom.Attr
getAttribute
on the
Element
interface.
Text
node with the unparsed
contents of the string, i.e. any characters that an XML processor
would recognize as markup are instead treated as literal text. See
also the method Element.setAttribute()
.
setValue
in interface org.w3c.dom.Attr
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.public boolean isId()
org.w3c.dom.Attr
ownerElement
of this attribute
can be retrieved using the method Document.getElementById
. The implementation could use several ways to determine if an
attribute node is known to contain an identifier:
Document.normalizeDocument()
, the post-schema-validation
infoset contributions (PSVI contributions) values are used to
determine if this attribute is a schema-determined ID attribute using
the
schema-determined ID definition in [XPointer]
.
Document.normalizeDocument()
, the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID
attribute using the
DTD-determined ID definition in [XPointer]
.
Element.setIdAttribute()
,
Element.setIdAttributeNS()
, or
Element.setIdAttributeNode()
, i.e. it is an
user-determined ID attribute;
Note: XPointer framework (see section 3.2 in [XPointer] ) consider the DOM user-determined ID attribute as being part of the XPointer externally-determined ID definition.
Document.normalizeDocument()
, all user-determined ID
attributes are reset and all attribute nodes ID information are then
reevaluated in accordance to the schema used. As a consequence, if
the Attr.schemaTypeInfo
attribute contains an ID type,
isId
will always return true.isId
in interface org.w3c.dom.Attr
public org.w3c.dom.TypeInfo getSchemaTypeInfo()
getSchemaTypeInfo
in interface org.w3c.dom.Attr
Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.