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

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

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

This class represents a single attribute.

Version:
$Id: AttrImpl.java,v 1.5 2003/03/20 00:38:30 elena Exp $
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_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
AttrImpl()
          Default Constructor
AttrImpl(org.w3c.dom.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.
 org.w3c.dom.Element getOwnerElement()
          The Element node this attribute is attached to or null if this attribute is not in use.
 org.apache.xerces.dom3.TypeInfo getSchemaTypeInfo()
          Method getSchemaTypeInfo.
 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.
 boolean isId()
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Constructor Detail

AttrImpl

public AttrImpl()
Default Constructor


AttrImpl

public AttrImpl(org.w3c.dom.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: org.w3c.dom.Attr
Returns the name of this attribute.

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

getSpecified

public boolean getSpecified()
Description copied from interface: org.w3c.dom.Attr
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 org.w3c.dom.Attr

getValue

public java.lang.String getValue()
Description copied from interface: org.w3c.dom.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 setAttribute on the Element interface.

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

getOwnerElement

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

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

setValue

public void setValue(java.lang.String value)
              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.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 setAttribute on the Element interface.

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

isId

public boolean isId()
Since:
DOM Level 3

getSchemaTypeInfo

public org.apache.xerces.dom3.TypeInfo getSchemaTypeInfo()
Method getSchemaTypeInfo.

Returns:
TypeInfo


Copyright ? 1999-2004 Apache XML Project. All Rights Reserved.