com.novell.xml.dom
Class AttrImpl

java.lang.Object
  extended bycom.novell.xml.dom.NodeImpl
      extended bycom.novell.xml.dom.AttrImpl
All Implemented Interfaces:
Attr, Cloneable, Comparable, Node

public class AttrImpl
extends NodeImpl
implements Attr

Implementation of DOM level 1 Attr interface.


Field Summary
 
Fields inherited from class com.novell.xml.dom.NodeImpl
allowedChildren, baseURI, changeCount, document, documentOrderVal, expandedName, firstChild, lastChild, localName, namespaceURI, nextOrderVal, nextSibling, nodeName, nodeValue, parentNode, prefix, previousSibling, toStringSerializes, xmlnsPrefix, xmlPrefix, xpathBehavior
 
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(DocumentImpl owner, String name)
           
protected AttrImpl(DocumentImpl owner, String namespaceURI, String qualifiedName)
           
 
Method Summary
 String getBaseURI()
          Return the base URI string for this node.
 String getName()
          Returns the name of this attribute.
 short getNodeType()
          A code representing the type of the underlying object, as defined above.
 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.
 Node getParentNode()
          The parent of this node.
 boolean getSpecified()
          If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false.
 String getValue()
          On retrieval, the value of the attribute is returned as a string.
protected  void incChangeCount()
          Increment the change count so that NodeList implementations can know when things change Note that only structural changes need to inc the change count This overrides NodeImpl
 boolean isId()
          Return true if this attribute represents an id attribute Non-DOM
protected  boolean isInUse()
          Return true if this attribute is currently owned by an Element
 void setIdType(boolean idType)
          Set whether this attribute is an id type or not
 void setNodeValue(String nodeValue)
           
protected  void setOwningElement(Element owningElement)
          Set the owning element of this attribute node.
protected  void setSpecified(boolean specified)
           
 void setValue(String value)
           
 
Methods inherited from class com.novell.xml.dom.NodeImpl
appendChild, checkName, checkNameNS, cloneNode, compareTo, fetchNamespacesFromDecls, gateModify, getAttributes, getChangeCount, getChildNodes, getColumnNumber, getDocumentOrder, getExpandedName, getFirstChild, getLastChild, getLineNumber, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getOwnerDocument, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isChildAllowed, isReadOnly, isSupported, normalize, purgeCachedExpandedNames, removeChild, replaceChild, setBaseURI, setColumnNumber, setDeepReadOnly, setDocumentOrder, setLineNumber, setOwnerDocument, setPrefix, setReadOnly, setXPathBehavior, 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, getNodeName, getOwnerDocument, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setPrefix
 

Constructor Detail

AttrImpl

protected AttrImpl(DocumentImpl owner,
                   String name)

AttrImpl

protected AttrImpl(DocumentImpl owner,
                   String namespaceURI,
                   String qualifiedName)
Method Detail

getNodeType

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

Specified by:
getNodeType in interface Node
Specified by:
getNodeType in class NodeImpl

getNodeValue

public String getNodeValue()
                    throws DOMException
The value of this node, depending on its type; see the table above.

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(String nodeValue)
                  throws DOMException
Specified by:
setNodeValue in interface Node
Overrides:
setNodeValue in class NodeImpl
Throws:
DOMException

getParentNode

public Node getParentNode()
The parent of this node. All nodes, except Document, DocumentFragment, and Attr may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null. Note: this implementation may return the owning element as the parent node if setXpathBehavior(true) has been called.

Specified by:
getParentNode in interface Node
Overrides:
getParentNode in class NodeImpl

getName

public 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.

Specified by:
getSpecified in interface Attr

getValue

public String getValue()
On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values.
On setting, this creates a Text node with the unparsed contents of the string.

Specified by:
getValue in interface Attr

setValue

public void setValue(String value)
Specified by:
setValue in interface Attr

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

isId

public boolean isId()
Return true if this attribute represents an id attribute Non-DOM

Returns:
true if this attribute represents an id attribute

setIdType

public void setIdType(boolean idType)
Set whether this attribute is an id type or not

Parameters:
idType - True if this attribute is an id type

getBaseURI

public String getBaseURI()
Return the base URI string for this node. If the base URI has not been explicitly set for this node the base URI of the parent node is returned. This may return null if the base URI has not been set for any node in this nodes chain of ancestors.

Overrides:
getBaseURI in class NodeImpl
Returns:
The base URI string for this node, or null if no base URI has been set for this node or one of its ancestors.
See Also:
NodeImpl.setBaseURI(java.lang.String)

incChangeCount

protected void incChangeCount()
Increment the change count so that NodeList implementations can know when things change Note that only structural changes need to inc the change count This overrides NodeImpl

Overrides:
incChangeCount in class NodeImpl

setOwningElement

protected void setOwningElement(Element owningElement)
Set the owning element of this attribute node. This is used for xpath behavior which specifies that getParentNode() returns the owning element rather than null as DOM level 1 specifies.

Parameters:
owningElement - The element that owns this attribute

isInUse

protected boolean isInUse()
Return true if this attribute is currently owned by an Element

Returns:
true if this attribute is owned by an Element

setSpecified

protected void setSpecified(boolean specified)