org.ozoneDB.xml.dom
Class AttrImpl

java.lang.Object
  |
  +--org.ozoneDB.OzoneObject
        |
        +--org.ozoneDB.xml.dom.NodeImpl
              |
              +--org.ozoneDB.xml.dom.AttrImpl
All Implemented Interfaces:
org.w3c.dom.Attr, AttrProxy, java.io.Externalizable, org.w3c.dom.Node, NodeProxy, org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, org.ozoneDB.OzoneRemote, java.io.Serializable

public final class AttrImpl
extends NodeImpl
implements AttrProxy, java.io.Externalizable

Represents an attribute in an Element node.

Attributes are not real nodes, they are not children in their parent element and the methods NodeImpl.getParentNode(), NodeImpl.getNextSibling() and NodeImpl.getPreviousSibling() always return null.

Attributes in XML documents support children, but only of the type Text and EntityReference.

The specified value of an attribute indicates whether it's value has been changed since it was constructed with the default value. The specified value is not used when cloning an attribute or testing for equality.

To speed up implementation, all attributes are implemented as double-linked list using NodeImpl#_parent, NodeImpl#_nextNode and NodeImpl#_prevNode.

Version:
$Revision: 1.1 $ $Date: 2001/12/18 11:03:24 $
Author:
Assaf Arkin
See Also:
Attr, NodeImpl, ElementImpl, Serialized Form

Field Summary
 
Fields inherited from class org.ozoneDB.xml.dom.NodeImpl
ATTLIST_DECL_NODE, ELEMENT_DECL_NODE, PARAM_ENTITY_NODE
 
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()
           
 
Method Summary
protected  org.w3c.dom.Node castNewChild(org.w3c.dom.Node newChild)
          Assures that the children of an attribute are either Text or EntityReference.
 java.lang.Object clone()
           
 void cloneInto(NodeProxy into, boolean deep)
          This clone method is called after a new node has been constructed to copy the contents of this node into the new one.
 org.w3c.dom.Node cloneNode(boolean deep)
           
 java.lang.String getName()
           
 short getNodeType()
          Abstract method must be implemented by each node class.
 org.w3c.dom.Element getOwnerElement()
           
 boolean getSpecified()
           
 java.lang.String getValue()
           
 void init(DocumentProxy owner, java.lang.String name, java.lang.String value)
           
 void readExternal(java.io.ObjectInput in)
           
 void setNodeValue(java.lang.String value)
          Changes the value of the node.
 void setSpecified(boolean value)
           
 void setValue(java.lang.String value)
           
protected  boolean supportsChildern()
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.ozoneDB.xml.dom.NodeImpl
appendChild, castOldChild, getAttributes, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, init, insertBefore, isReadOnly, isSupported, normalize, notifyIterators, removeChild, replaceChild, setNextSibling, setNodeName, setOwnerDocument, setParentNode, setPrefix, setPreviousSibling, setReadOnly, supports
 
Methods inherited from class org.ozoneDB.OzoneObject
container, database, deleteRecursive, getObjectID, handle, hashCode, onCreate, onDelete, self, setContainer, toXML
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setPrefix
 
Methods inherited from interface org.ozoneDB.xml.dom.NodeProxy
getChild, getChildCount, getChildNodes, init, isReadOnly, setNextSibling, setNodeName, setOwnerDocument, setParentNode, setPreviousSibling, setReadOnly
 

Constructor Detail

AttrImpl

public AttrImpl()
Method Detail

getOwnerElement

public org.w3c.dom.Element getOwnerElement()
Specified by:
getOwnerElement in interface org.w3c.dom.Attr

getNodeType

public final short getNodeType()
Description copied from class: NodeImpl
Abstract method must be implemented by each node class.

Specified by:
getNodeType in interface org.w3c.dom.Node
Specified by:
getNodeType in class NodeImpl
See Also:
Node.getNodeType()

getName

public final java.lang.String getName()
Specified by:
getName in interface org.w3c.dom.Attr

getSpecified

public final boolean getSpecified()
Specified by:
getSpecified in interface org.w3c.dom.Attr

setSpecified

public void setSpecified(boolean value)
Specified by:
setSpecified in interface AttrProxy

getValue

public java.lang.String getValue()
Specified by:
getValue in interface org.w3c.dom.Attr

setNodeValue

public void setNodeValue(java.lang.String value)
Description copied from class: NodeImpl
Changes the value of the node. Not all node types support the notion of a value. If the value is not supported by a particular node type, it will throw an exception when calling this method. The following table specifies which node types support values:
 Element                  Not supported
 Attr                     Value supported
 Text                     Value supported
 CDATASection             Value supported
 EntityReference          Not supported
 Entity                   Not supported
 ProcessingInstruction    Value supported
 Comment                  Value supported
 Document                 Not supported
 DocumentType             Not supported
 DocumentFragment         Not supported
 Notation                 Not supported
 
For most node types, if the value is set to null, NodeImpl.getNodeValue() will return an empty string instead.

Specified by:
setNodeValue in interface org.w3c.dom.Node
Overrides:
setNodeValue in class NodeImpl
Parameters:
value - New value of node

setValue

public void setValue(java.lang.String value)
Specified by:
setValue in interface org.w3c.dom.Attr

toString

public java.lang.String toString()
Overrides:
toString in class org.ozoneDB.OzoneObject

supportsChildern

protected boolean supportsChildern()
Overrides:
supportsChildern in class NodeImpl

clone

public final java.lang.Object clone()
Overrides:
clone in class java.lang.Object

cloneNode

public final org.w3c.dom.Node cloneNode(boolean deep)
Specified by:
cloneNode in interface org.w3c.dom.Node

cloneInto

public void cloneInto(NodeProxy into,
                      boolean deep)
Description copied from class: NodeImpl
This clone method is called after a new node has been constructed to copy the contents of this node into the new one. It clones in contents but not in context, and guarantees that the cloned node will pass the equality test (see Object.equals(java.lang.Object)).

into must be a valid node of the exact same class as this one. deep is true if deep cloning (includes all children nodes) is to be performed. If deep is false, the clone might not pass the equality test.

Derived classes override and call this method to add per-class variable copying. This method is called by Node.cloneNode(boolean) and the default Object.clone() method.

Contents cloning duplicates the node's name and value, and its children. It does not duplicate it's context, that is, the node's parent or sibling. Initially a clone node has no parents or siblings. However, the node does belong to the same document, since all nodes must belong to some document. The cloned node is never read-only.

Specified by:
cloneInto in interface NodeProxy
Overrides:
cloneInto in class NodeImpl
Parameters:
into - A node into which to duplicate this one
deep - True if deep cloning is required

castNewChild

protected org.w3c.dom.Node castNewChild(org.w3c.dom.Node newChild)
                                 throws org.w3c.dom.DOMException
Assures that the children of an attribute are either Text or EntityReference.

Overrides:
castNewChild in class NodeImpl
Parameters:
newChild - New child node
Returns:
newChild cast to type NodeImpl
Throws:
org.w3c.dom.DOMException - HIERARCHY_REQUEST_ERR newChild is null, does not belong to this DOM, or its node type is not supported for this parent
See Also:
NodeImpl.castNewChild(org.w3c.dom.Node)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class NodeImpl
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class NodeImpl
java.io.IOException
java.lang.ClassNotFoundException

init

public final void init(DocumentProxy owner,
                       java.lang.String name,
                       java.lang.String value)
Specified by:
init in interface AttrProxy


Copyright © 2002 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.