|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.dom.NodeImpl | +--org.apache.xerces.dom.NodeContainer | +--org.apache.xerces.dom.AttrImpl
Attribute represents an XML-style attribute of an Element. Typically, the allowable values are controlled by its declaration in the Document Type Definition (DTD) governing this kind of document.
If the attribute has not been explicitly assigned a value, but has been declared in the DTD, it will exist and have that default. Only if neither the document nor the DTD specifies a value will the Attribute really be considered absent and have no value; in that case, querying the attribute will return null.
Attributes may have multiple children that contain their data. (XML allows attributes to contain entity references, and tokenized attribute types such as NMTOKENS may have a child for each token.) For convenience, the Attribute object's getValue() method returns the string version of the attribute's value.
Attributes are not children of the Elements they belong to, in the usual sense, and have no valid Parent reference. However, the spec says they _do_ belong to a specific Element, and an INUSE exception is to be thrown if the user attempts to explicitly share them between elements.
Note that Elements do not permit attributes to appear to be shared (see the INUSE exception), so this object's mutability is officially not an issue.
Note: Attributes do not have parent nodes. In other words, the getParentNode() method is defined to return null for Attr nodes. However, the getElement() method will return the element node that this attribute is associated with.
AttrImpl does not support Namespaces. AttrNSImpl, which inherits from it, does.
AttrNSImpl
, Serialized FormField Summary | |
protected boolean |
owned
Flag used for INUSE exception processing. |
protected boolean |
specified
False for default attributes. |
Fields inherited from class org.apache.xerces.dom.NodeContainer |
firstChild,
kidOK,
lastChild,
nodeListChanges,
nodeListIndex,
nodeListLength,
nodeListNode,
syncChildren |
Fields inherited from class org.apache.xerces.dom.NodeImpl |
ELEMENT_DEFINITION_NODE,
fInternalSetNodeValue,
MUTATION_AGGREGATE,
MUTATION_ALL,
MUTATION_LOCAL,
MUTATION_NONE,
MUTATIONEVENTS,
name,
nextSibling,
ownerDocument,
parentNode,
previousSibling,
readOnly,
syncData,
userData,
value |
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE,
CDATA_SECTION_NODE,
COMMENT_NODE,
DOCUMENT_FRAGMENT_NODE,
DOCUMENT_NODE,
DOCUMENT_TYPE_NODE,
ELEMENT_NODE,
ENTITY_NODE,
ENTITY_REFERENCE_NODE,
NOTATION_NODE,
PROCESSING_INSTRUCTION_NODE,
TEXT_NODE |
Constructor Summary | |
protected |
AttrImpl()
|
protected |
AttrImpl(DocumentImpl ownerDocument,
java.lang.String name)
Attribute has no public constructor. |
Method Summary | |
Element |
getElement()
Deprecated. Previous working draft of DOM Level 2. New method is getOwnerElement(). |
java.lang.String |
getName()
In Attributes, NodeName is considered a synonym for the attribute's Name |
short |
getNodeType()
A short integer indicating what type of node this is. |
java.lang.String |
getNodeValue()
In Attribute objects, NodeValue is considered a synonym for Value. |
Element |
getOwnerElement()
Returns the element node that this attribute is associated with, or null if the attribute has not been added to an element. |
Node |
getParentNode()
Attributes don't have parent nodes. |
boolean |
getSpecified()
The "specified" flag is true if and only if this attribute's value was explicitly specified in the original document. |
java.lang.String |
getValue()
The "string value" of an Attribute is its text representation, which in turn is a concatenation of the string values of its children. |
void |
normalize()
Puts all Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
void |
setNodeValue(java.lang.String value)
Implicit in the rerouting of getNodeValue to getValue is the need to redefine setNodeValue, for symmetry's sake. |
void |
setSpecified(boolean arg)
NON-DOM, for use by parser |
void |
setValue(java.lang.String value)
The DOM doesn't clearly define what setValue(null) means. |
java.lang.String |
toString()
NON-DOM method for debugging convenience |
Methods inherited from class org.apache.xerces.dom.NodeContainer |
appendChild,
cloneNode,
getChildNodes,
getFirstChild,
getLastChild,
getLength,
hasChildNodes,
insertBefore,
item,
removeChild,
replaceChild,
setReadOnly,
synchronizeChildren |
Methods inherited from class org.apache.xerces.dom.NodeImpl |
addEventListener,
changed,
dispatchEvent,
finalize,
getAttributes,
getLocalName,
getNamespaceURI,
getNextSibling,
getNodeName,
getOwnerDocument,
getPrefix,
getPreviousSibling,
getReadOnly,
getUserData,
removeEventListener,
setPrefix,
setUserData,
supports,
synchronizeData |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected boolean owned
protected boolean specified
Constructor Detail |
protected AttrImpl(DocumentImpl ownerDocument, java.lang.String name)
protected AttrImpl()
Method Detail |
public short getNodeType()
public void setNodeValue(java.lang.String value) throws DOMException
public java.lang.String getNodeValue()
getValue()
public Node getParentNode()
public java.lang.String getName()
public void setValue(java.lang.String value)
public java.lang.String getValue()
public boolean getSpecified()
public Element getElement()
getOwnerElement()
public Element getOwnerElement()
public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text
nodes, i.e., there are neither adjacent
Text
nodes nor empty Text
nodes. This can be
used to ensure that the DOM view of a document is the same as if it
were saved and re-loaded, and is useful when operations (such as
XPointer lookups) that depend on a particular document tree structure
are to be used. In cases where the document contains
CDATASections
, the normalize operation alone may not be
sufficient, since XPointers do not differentiate between
Text
nodes and CDATASection
nodes.public void setSpecified(boolean arg)
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |