org.apache.xerces.impl.xs.opti
Class AttrImpl

java.lang.Object
  extended by org.apache.xerces.impl.xs.opti.DefaultNode
      extended by org.apache.xerces.impl.xs.opti.NodeImpl
          extended by org.apache.xerces.impl.xs.opti.AttrImpl
All Implemented Interfaces:
Attr, Node

public class AttrImpl
extends NodeImpl
implements Attr

This class represents a single attribute.

Version:
$Id: AttrImpl.java 446728 2006-09-15 20:43:46Z mrglavas $
Author:
Rahul Srivastava, Sun Microsystems Inc.

Field Summary
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
AttrImpl()
          Default Constructor
AttrImpl(Element element, java.lang.String prefix, java.lang.String localpart, java.lang.String rawname, java.lang.String uri, java.lang.String value)
          Constructs an attribute.
 
Method Summary
 java.lang.String getName()
          Returns the name of this attribute.
 Element getOwnerElement()
          The Element node this attribute is attached to or null if this attribute is not in use.
 TypeInfo getSchemaTypeInfo()
          Method getSchemaTypeInfo.
 boolean getSpecified()
          True if this attribute was explicitly given a value in the instance document, false otherwise.
 java.lang.String getValue()
          On retrieval, the value of the attribute is returned as a string.
 boolean isId()
          Returns whether this attribute is known to be of type ID (i.e.
 void setValue(java.lang.String value)
          On retrieval, the value of the attribute is returned as a string.
 
Methods inherited from class org.apache.xerces.impl.xs.opti.NodeImpl
getLocalName, getNamespaceURI, getNodeName, getNodeType, getPrefix, getReadOnly, setReadOnly
 
Methods inherited from class org.apache.xerces.impl.xs.opti.DefaultNode
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Constructor Detail

AttrImpl

public AttrImpl()
Default Constructor


AttrImpl

public AttrImpl(Element element,
                java.lang.String prefix,
                java.lang.String localpart,
                java.lang.String rawname,
                java.lang.String uri,
                java.lang.String value)
Constructs an attribute.

Parameters:
element - Element which owns this attribute
prefix - The QName prefix.
localpart - The QName localpart.
rawname - The QName rawname.
uri - The uri binding for the associated prefix.
value - The value of the attribute.
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Attr
Returns the name of this attribute. If Node.localName is different from null, this attribute is a qualified name.

Specified by:
getName in interface Attr

getSpecified

public boolean getSpecified()
Description copied from interface: Attr
True if this attribute was explicitly given a value in the instance document, false otherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set to true. The implementation may handle attributes with default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.

Specified by:
getSpecified in interface Attr

getValue

public java.lang.String getValue()
Description copied from interface: Attr
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 Element.setAttribute().
Some specialized implementations, such as some [SVG 1.1] implementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting.

Specified by:
getValue in interface Attr

getOwnerElement

public Element getOwnerElement()
Description copied from interface: Attr
The Element node this attribute is attached to or null if this attribute is not in use.

Specified by:
getOwnerElement in interface Attr

setValue

public void setValue(java.lang.String value)
              throws DOMException
Description copied from interface: Attr
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 Element.setAttribute().
Some specialized implementations, such as some [SVG 1.1] implementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting.

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

isId

public boolean isId()
Description copied from interface: Attr
Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, the ownerElement of this attribute can be retrieved using the method Document.getElementById . The implementation could use several ways to determine if an attribute node is known to contain an identifier:
If validation occurred while invoking Document.normalizeDocument(), all user-determined ID attributes are reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if the Attr.schemaTypeInfo attribute contains an ID type, isId will always return true.

Specified by:
isId in interface Attr
Since:
DOM Level 3

getSchemaTypeInfo

public TypeInfo getSchemaTypeInfo()
Method getSchemaTypeInfo.

Specified by:
getSchemaTypeInfo in interface Attr
Returns:
TypeInfo