org.eclipse.ercp.xml.dom
Class AttrImpl

java.lang.Object
  extended by org.eclipse.ercp.xml.dom.NodeImpl
      extended by org.eclipse.ercp.xml.dom.NSNodeImpl
          extended by org.eclipse.ercp.xml.dom.AttrImpl
All Implemented Interfaces:
Attr, Node, NodeList

public class AttrImpl
extends NSNodeImpl
implements Attr


Field Summary
protected  ElementImpl ownerElement
           
protected  java.lang.String value
           
 
Fields inherited from class org.eclipse.ercp.xml.dom.NSNodeImpl
localName, namespaceURI, prefix, qualifiedName
 
Fields inherited from class org.eclipse.ercp.xml.dom.NodeImpl
ownerDocument
 
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
AttrImpl(DocumentImpl ownerDocument, java.lang.String qualifiedName)
          Constructor for AttrImpl
AttrImpl(DocumentImpl ownerDocument, java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 
Method Summary
 Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
 java.lang.String getName()
          Returns the name of this attribute.
 short getNodeType()
          A code representing the type of the underlying object, as defined above.
 java.lang.String getNodeValue()
          The value of this node, depending on its type; see the table above.
 Element getOwnerElement()
          The Element node this attribute is attached to or null if this attribute is not in use.
 boolean getSpecified()
          If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false.
 java.lang.String getValue()
          On retrieval, the value of the attribute is returned as a string.
 void setNodeValue(java.lang.String nodeValue)
           
 void setValue(java.lang.String value)
           
 
Methods inherited from class org.eclipse.ercp.xml.dom.NSNodeImpl
getLocalName, getNamespaceURI, getNodeName, getPrefix, setPrefix
 
Methods inherited from class org.eclipse.ercp.xml.dom.NodeImpl
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLength, getNextSibling, getOwnerDocument, getParentNode, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, item, normalize, removeChild, replaceChild, spreadOwnerDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setPrefix
 

Field Detail

value

protected java.lang.String value

ownerElement

protected ElementImpl ownerElement
Constructor Detail

AttrImpl

public AttrImpl(DocumentImpl ownerDocument,
                java.lang.String qualifiedName)
Constructor for AttrImpl


AttrImpl

public AttrImpl(DocumentImpl ownerDocument,
                java.lang.String namespaceURI,
                java.lang.String qualifiedName)
Method Detail

getName

public java.lang.String getName()
Returns the name of this attribute.

Specified by:
getName in interface Attr

getSpecified

public boolean getSpecified()
If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false. Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then the specified flag is automatically flipped to true. To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available with specified set to false and the default value (if one exists).
In summary: If the attribute has an assigned value in the document then specified is true, and the value is the assigned value. If the attribute has no assigned value in the document and has a default value in the DTD, then specified is false, and the value is the default value in the DTD. If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document. If the ownerElement attribute is null (i.e. because it was just created or was set to null by the various removal and cloning operations) specified is true.

Specified by:
getSpecified in interface Attr

getValue

public java.lang.String getValue()
On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface.
On setting, this creates a 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 setAttribute on the Element interface.

Specified by:
getValue in interface Attr
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

setValue

public void setValue(java.lang.String value)
              throws DOMException
Specified by:
setValue in interface Attr
Throws:
DOMException

getOwnerElement

public Element getOwnerElement()
The Element node this attribute is attached to or null if this attribute is not in use.

Specified by:
getOwnerElement in interface Attr
Since:
DOM Level 2

getNodeType

public short getNodeType()
A code representing the type of the underlying object, as defined above.

Specified by:
getNodeType in interface Node

getNodeValue

public java.lang.String getNodeValue()
                              throws DOMException
The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect.

Specified by:
getNodeValue in interface Node
Overrides:
getNodeValue in class NodeImpl
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws DOMException
Specified by:
setNodeValue in interface Node
Overrides:
setNodeValue in class NodeImpl
Throws:
DOMException

cloneNode

public Node cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent; ( parentNode is null.).
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning an Attribute directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute ( specified is true). Cloning any other type of node simply returns a copy of this node.
Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly . In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Specified by:
cloneNode in interface Node
Parameters:
deepIf - true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
Returns:
The duplicate node.