org.enhydra.xml
Class AttrImpl

java.lang.Object
  |
  +--org.enhydra.xml.NodeImpl
        |
        +--org.enhydra.xml.AttrImpl
All Implemented Interfaces:
org.w3c.dom.Attr, org.w3c.dom.Node, org.w3c.dom.NodeList

public class AttrImpl
extends NodeImpl
implements org.w3c.dom.Attr

Version:
1.0
Author:
Tweety A class representing a node in a meta-data tree, which implements the

Namespaces are ignored in this implementation. The terms "tag name" and "node name" are always considered to be synonymous.


Field Summary
 
Fields inherited from class org.enhydra.xml.NodeImpl
firstChild, lastChild, nextSibling, nodeName, nodeValue, numChildren, ownerDocument, parent, previousSibling, type
 
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(org.w3c.dom.Attr attr)
          Constructs a AttrImpl from the given node.
AttrImpl(org.w3c.dom.Element owner, java.lang.String name, java.lang.String value)
          Constructs an empty AttrImpl.
 
Method Summary
 java.lang.String getName()
          Returns the attribute name associated with this node.
 java.lang.String getNodeName()
          Returns the name associated with this node.
 short getNodeType()
          Returns the node type.
 java.lang.String getNodeValue()
          Returns the value associated with this node.
 org.w3c.dom.Element getOwnerElement()
          Returns the owner of this attribute.
 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()
          Returns the value associated with this attributes.
 void setNodeValue(java.lang.String value)
          Sets the value of this node to the given one.
 void setValue(java.lang.String value)
          Sets the value of this attribute to the given one.
 
Methods inherited from class org.enhydra.xml.NodeImpl
appendChild, beginToString, cloneNode, endToString, getAttributes, getChildNodes, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, initNodeImplChildren, insertBefore, isSupported, item, newCommentInstance, newDefaultInstance, newElementInstance, newTextInstance, normalize, removeChild, replaceChild, setPrefix, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setPrefix
 

Constructor Detail

AttrImpl

public AttrImpl(org.w3c.dom.Element owner,
                java.lang.String name,
                java.lang.String value)
Constructs an empty AttrImpl.

Parameters:
owner - document owner.
name - node name.
value - node value.

AttrImpl

public AttrImpl(org.w3c.dom.Attr attr)
Constructs a AttrImpl from the given node.

Method Detail

getName

public java.lang.String getName()
Returns the attribute name associated with this node.

Specified by:
getName in interface org.w3c.dom.Attr
Returns:
the attribute name, as a String.

getNodeName

public java.lang.String getNodeName()
Returns the name associated with this node.

Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in class NodeImpl
Returns:
the name, as a String.

getNodeType

public short getNodeType()
Returns the node type.

Specified by:
getNodeType in interface org.w3c.dom.Node
Overrides:
getNodeType in class NodeImpl
Returns:
the ATTRIBUTE_NODE node type.

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. Retuns always true.

Specified by:
getSpecified in interface org.w3c.dom.Attr

getValue

public java.lang.String getValue()
Returns the value associated with this attributes.

Specified by:
getValue in interface org.w3c.dom.Attr
Returns:
the node attributes, as a String.

getNodeValue

public java.lang.String getNodeValue()
Returns the value associated with this node.

Specified by:
getNodeValue in interface org.w3c.dom.Node
Overrides:
getNodeValue in class NodeImpl
Returns:
the node value, as a String.

setValue

public void setValue(java.lang.String value)
Sets the value of this attribute to the given one.

Specified by:
setValue in interface org.w3c.dom.Attr
Parameters:
value - the new attribute value, as a String.

setNodeValue

public void setNodeValue(java.lang.String value)
Sets the value of this node to the given one.

Specified by:
setNodeValue in interface org.w3c.dom.Node
Overrides:
setNodeValue in class NodeImpl
Parameters:
value - new node value, as a String.
Returns:
the node value, as a String.

getOwnerElement

public org.w3c.dom.Element getOwnerElement()
Returns the owner of this attribute.

Specified by:
getOwnerElement in interface org.w3c.dom.Attr
Returns:
the attribute owner node.


Copyright © 2002-2003 Together - the Workgroup. All Rights Reserved.