|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
org.w3c.dom
|
Examples | Parsed attribute value | Initial Attr.value |
Serialized attribute value |
---|---|---|---|
Character reference |
"x²=5" |
"x²=5" |
"x²=5" |
Built-in character entity |
"y<6" |
"y<6" |
"y<6" |
Literal newline between |
"x=5 y=6" |
"x=5 y=6" |
"x=5 y=6" |
Normalized newline between |
"x=5 y=6" |
"x=5 y=6" |
"x=5 y=6" |
Entity e with literal newline |
<!ENTITY e '... ...'> [...]> "x=5&e;y=6" |
Dependent on Implementation and Load Options | Dependent on Implementation and Load/Save Options |
See also the Document Object Model (DOM) Level 3 Core Specification.
Field Summary |
---|
Method Summary | |
---|---|
String |
getName()
Returns the name of this attribute. |
Element |
getOwnerElement()
The Element node this attribute is attached to or
null if this attribute is not in use. |
TypeInfo |
getSchemaTypeInfo()
The type information associated with this attribute. |
boolean |
getSpecified()
True if this attribute was explicitly given a value in
the instance document, false otherwise. |
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(String value)
On retrieval, the value of the attribute is returned as a string. |
Methods inherited from interface org.w3c.dom.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 |
Method Detail |
---|
String getName()
Node.localName
is
different from null
, this attribute is a qualified name.
boolean getSpecified()
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.
String getValue()
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()
.
void setValue(String value) throws DOMException
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()
.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.Element getOwnerElement()
Element
node this attribute is attached to or
null
if this attribute is not in use.
TypeInfo getSchemaTypeInfo()
Document.normalizeDocument()
, schemaTypeInfo
may not be reliable if the node was moved.
boolean isId()
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.