APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.impl.xs.opti

public Class AttrImpl

extends NodeImpl
implements Attr
Class Inheritance
All Implemented Interfaces
org.w3c.dom.Attr, org.w3c.dom.Node
Imports
org.w3c.dom.Attr, .DOMException, .Document, .Element, .Node, .TypeInfo

This class represents a single attribute.
Author
Rahul Srivastava, Sun Microsystems Inc.

Field Summary

Modifier and TypeField and Description
pack-priv Element
pack-priv String
Inherited from com.sun.org.apache.xerces.internal.impl.xs.opti.NodeImpl:
hiddenlocalpartnodeTypeprefixrawnameuri

Constructor Summary

AccessConstructor and Description
public
AttrImpl()

Default Constructor

public
AttrImpl(Element
Element which owns this attribute
element
,
String
The QName prefix.
prefix
,
String
The QName localpart.
localpart
,
String
The QName rawname.
rawname
,
String
The uri binding for the associated prefix.
uri
,
String
The value of the attribute.
value
)

Constructs an attribute.

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Implements org.w3c.dom.Attr.getName.

Returns the name of this attribute.

public String
getNodeValue()

Overrides com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode.getNodeValue.

Implements org.w3c.dom.Node.getNodeValue.

The value of this node, depending on its type; see the table above.

public Document
public Element
getOwnerElement()

Implements org.w3c.dom.Attr.getOwnerElement.

The Element node this attribute is attached to or null if this attribute is not in use.

public TypeInfo

Returns:

TypeInfo
getSchemaTypeInfo
()

Implements org.w3c.dom.Attr.getSchemaTypeInfo.

Method getSchemaTypeInfo.

public boolean
getSpecified()

Implements org.w3c.dom.Attr.getSpecified.

True if this attribute was explicitly given a value in the instance document, false otherwise.

public String
getValue()

Implements org.w3c.dom.Attr.getValue.

On retrieval, the value of the attribute is returned as a string.

public boolean
isId()

Implements org.w3c.dom.Attr.isId.

Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.

public void
setValue(String value)

Implements org.w3c.dom.Attr.setValue.

On retrieval, the value of the attribute is returned as a string.

public String
toString()

Overrides java.lang.Object.toString.

NON-DOM method for debugging convenience

Inherited from com.sun.org.apache.xerces.internal.impl.xs.opti.NodeImpl:
getLocalNamegetNamespaceURIgetNodeNamegetNodeTypegetPrefixgetReadOnlysetReadOnly

Field Detail

elementback to summary
pack-priv Element element
valueback to summary
pack-priv String value

Constructor Detail

AttrImplback to summary
public AttrImpl()

Default Constructor

AttrImplback to summary
public AttrImpl(Element element, String prefix, String localpart, String rawname, String uri, String value)

Constructs an attribute.

Parameters
element:Element

Element which owns this attribute

prefix:String

The QName prefix.

localpart:String

The QName localpart.

rawname:String

The QName rawname.

uri:String

The uri binding for the associated prefix.

value:String

The value of the attribute.

Method Detail

getNameback to summary
public String getName()

Implements org.w3c.dom.Attr.getName.

Doc from org.w3c.dom.Attr.getName.

Returns the name of this attribute. If Node.localName is different from null, this attribute is a qualified name.

getNodeValueback to summary
public String getNodeValue()

Overrides com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode.getNodeValue.

Implements org.w3c.dom.Node.getNodeValue.

Doc from org.w3c.dom.Node.getNodeValue.

The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect, including if the node is read-only.

getOwnerDocumentback to summary
public Document getOwnerDocument()

Overrides com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode.getOwnerDocument.

Implements org.w3c.dom.Node.getOwnerDocument.

Doc from org.w3c.dom.Node.getOwnerDocument.

The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.

getOwnerElementback to summary
public Element getOwnerElement()

Implements org.w3c.dom.Attr.getOwnerElement.

Doc from org.w3c.dom.Attr.getOwnerElement.

The Element node this attribute is attached to or null if this attribute is not in use.

getSchemaTypeInfoback to summary
public TypeInfo getSchemaTypeInfo()

Implements org.w3c.dom.Attr.getSchemaTypeInfo.

Method getSchemaTypeInfo.

Returns:TypeInfo

TypeInfo

getSpecifiedback to summary
public boolean getSpecified()

Implements org.w3c.dom.Attr.getSpecified.

Doc from org.w3c.dom.Attr.getSpecified.

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.

getValueback to summary
public String getValue()

Implements org.w3c.dom.Attr.getValue.

Doc from org.w3c.dom.Attr.getValue.

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.

isIdback to summary
public boolean isId()

Implements org.w3c.dom.Attr.isId.

Doc from org.w3c.dom.Attr.isId.

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 using an XML Schema [XML Schema Part 1] while loading the document or while invoking Document.normalizeDocument(), the post-schema-validation infoset contributions (PSVI contributions) values are used to determine if this attribute is a schema-determined ID attribute using the schema-determined ID definition in [XPointer] .
  • If validation occurred using a DTD while loading the document or while invoking Document.normalizeDocument(), the infoset [type definition] value is used to determine if this attribute is a DTD-determined ID attribute using the DTD-determined ID definition in [XPointer] .
  • from the use of the methods Element.setIdAttribute(), Element.setIdAttributeNS(), or Element.setIdAttributeNode(), i.e. it is an user-determined ID attribute;

    Note: XPointer framework (see section 3.2 in [XPointer] ) consider the DOM user-determined ID attribute as being part of the XPointer externally-determined ID definition.

  • using mechanisms that are outside the scope of this specification, it is then an externally-determined ID attribute. This includes using schema languages different from XML schema and DTD.

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.
Since
DOM Level 3
setValueback to summary
public void setValue(String value) throws DOMException

Implements org.w3c.dom.Attr.setValue.

Doc from org.w3c.dom.Attr.setValue.

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.

Exceptions
DOMException:
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

NON-DOM method for debugging convenience