Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

## oracle.xml.parser.v2
Class XMLAttr

`java.lang.Object
oracle.xml.parser.v2.XMLNode
oracle.xml.parser.v2.XMLNSNode
oracle.xml.parser.v2.XMLAttr`

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, NSName, Attr, EventTarget, Node, NodeEditVAL

      public class XMLAttr

extends XMLNSNode
implements Attr, NSName, java.io.Externalizable

This class implements the DOM Attr interface and holds information on each attribute of an element.

See Also:
  `Attr`, `NodeFactory`, `DOMParser.setNodeFactory(oracle.xml.parser.v2.NodeFactory)`, Serialized Form

Field Summary

Fields inherited from class oracle.xml.parser.v2.XMLNode

`ATTRDECL, Auto_Events, capturing, DOMAttrModified, DOMCharacterDataModified, DOMNodeInserted, DOMNodeInsertedIntoDocument, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified, ELEMENTDECL, KEPT_NODE, NAMESPACE_NODE, noncapturing, RANGE_DELETE_EVENT, RANGE_DELETETEXT_EVENT, RANGE_INSERT_EVENT, RANGE_INSERTTEXT_EVENT, RANGE_REPLACE_EVENT, RANGE_SETTEXT_EVENT, SCHEMA_NILLED, TRAVERSAL_DELETE_EVENT, TRAVERSAL_REPLACE_EVENT, XMLDECL_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`

Fields inherited from interface org.w3c.dom.validation.NodeEditVAL
`VAL_FALSE, VAL_INCOMPLETE, VAL_NS_WF, VAL_SCHEMA, VAL_TRUE, VAL_UNKNOWN, VAL_WF`

Constructor Summary
`` `XMLAttr()` Deprecated. use createAttribute(String) or createAttributeNS(String, String) of XMLDocument
`` `XMLAttr(java.lang.String n, java.lang.String v)` Deprecated. use createAttribute(String) method of XMLDocument
`` `XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String namespace, java.lang.String v)` Deprecated. use createAttributeNS(String, String) method of XMLDocument
`` `XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String qname, java.lang.String namespace, java.lang.String v)` Deprecated. use crateAttribute(String) or createAttributeNS(String, String) of XMLDocument
`protected` `XMLAttr(XMLDocument doc)` Protected constructor used to create custom DOM Node using XMLDocument as the factory.
`protected` `XMLAttr(XMLDocument doc, java.lang.String namespace, java.lang.String qname)` Protected constructor used to create custom DOM Node using XMLDocument as the factory.

Method Summary
`XMLNode` `addText(java.lang.String str)` Append the given value to the attribute value
`short` `canRemoveChild(Node oldChild)` Determines whether the `Node.removeChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
`DOMStringList` `getEnumeratedValues()` A `DOMStringList`, as described in [DOM Level 3 Core] , of distinct values for an attribute or an element declaration or `null` if unspecified.
`java.lang.String` `getExpandedName()` Gets the fully resolved Name for this attribute
`Node` `getFirstChild()` Gets the first child of this node.
`Node` `getLastChild()` Gets the last child of this node.
`java.lang.String` `getLocalName()` Gets the Local Name of this node
`java.lang.String` `getName()` Gets the attribute name.
`java.lang.String` `getNamespaceURI()` Gets the namespace URI of this node.
`XMLAttr` `getNextAttribute()` Gets the next attribute if any
`Node` `getNextSibling()` Gets The node immediately following this node.
`java.lang.String` `getNodeName()` Gets the name of this node, depending on its type
`short` `getNodeType()` Gets a code representing the type of the underlying object
`java.lang.String` `getNodeValue()` Gets the value of this node, depending on its type
`Element` `getOwnerElement()` Gets the element which owns this attribute
`Node` `getParentNode()` Gets the parent of this node.
`java.lang.String` `getPrefix()` Get the namespace prefix for this element.
`XMLAttr` `getPrevAttribute()` Deprecated.
`Node` `getPreviousSibling()` Gets the node immediately preceding this node.
`java.lang.String` `getQualifiedName()` Gets the qualified name for this attribute
`boolean` `getSpecified()` Returns true if the attribute was specified explicity in the element
`java.lang.String` `getValue()` Gets the attribute value.
`void` `setNodeValue(java.lang.String nodeValue)` Sets the value of this node, depending on its type
`void` `setPrefix(java.lang.String prefix)` Sets the prefix for attribute Note that setting the prefix, when permitted, changes the nodeName.
`void` `setValue(java.lang.String arg)` Sets the value.

Methods inherited from class oracle.xml.parser.v2.XMLNSNode
`addText, appendChild, getChildNodes, getText, insertBefore, normalize, removeChild, replaceChild`

Methods inherited from class oracle.xml.parser.v2.XMLNode

`addEventListener, canAppendChild, canInsertBefore, canReplaceChild, cloneNode, dispatchEvent, equals, getAttributes, getColumnNumber, getDebugMode, getDefaultValue, getFirstChildAsOffset, getLineNumber, getNextSiblingAsOffset, getNodeValueAsBinaryStream, getNodeValueAsBinaryStream, getNodeValueAsCharacterStream, getNodeValueAsCharacterStream, getOwnerDocument, getPrimitiveTypeId, getProperty, getSystemId, getXMLError, hasAttributes, hasChildNodes, hashCode, isDocumentFlag, isNodeFlag, isSupported, nodeValidity, print, print, print, print, readExternal, removeEventListener, reportSAXEvents, resetNodeFlag, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setNodeFlag, setNodeFlag, setNodeValueAsBinaryStream, setNodeValueAsBinaryStream, setNodeValueAsCharacterStream, setNodeValueAsCharacterStream, setProperty, transformNode, valueOf, valueOf, writeExternal, xdbGetNodeId`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.w3c.dom.Node
`appendChild, cloneNode, getAttributes, getChildNodes, getOwnerDocument, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild`

Methods inherited from interface oracle.xml.util.NSName
`getNamespace`

Methods inherited from interface java.io.Externalizable
`readExternal, writeExternal`

Constructor Detail

### XMLAttr

    protected XMLAttr(XMLDocument doc)

  Protected constructor used to create custom DOM Node using XMLDocument as the factory. See method XMLDocument.createNodeFromType for details.
  Parameters:
    `doc` - - Owner document

### XMLAttr

    protected XMLAttr(XMLDocument doc,
                      java.lang.String namespace,
                      java.lang.String qname)

  Protected constructor used to create custom DOM Node using XMLDocument as the factory. See method XMLDocument.createNodeFromType for details.
  Parameters:
    `doc` - - Owner document
    `namespace` - Namespace of the attribute
    `qname` - Qname of the attribute

### XMLAttr

    public XMLAttr()

  Deprecated. use createAttribute(String) or createAttributeNS(String, String) of XMLDocument
  Default constructor. Note that this constructor is used only during deserialization/decompression of this DOM node. In order to deserialize this node to construct the DOM node from the serialized/ compressed stream, it is required to create a handle of the object. For all normal XMLAttr creation use createAttribute(String) or createAttributeNS(String, String) of XMLDocument

### XMLAttr

    public XMLAttr(java.lang.String n,
                   java.lang.String v)

  Deprecated. use createAttribute(String) method of XMLDocument
  Construct attribute with given name and value.
  Parameters:
    `n` - Name of the attribute
    `v` - Value of the attribute

### XMLAttr

    public XMLAttr(java.lang.String name,
                   java.lang.String prefix,
                   java.lang.String namespace,
                   java.lang.String v)

  Deprecated. use createAttributeNS(String, String) method of XMLDocument
  Namespace support
  Parameters:
    `name` - Local name of the attribute
    `prefix` - Prefix of the attribute
    `namespace` - Namespace of the attribute
    `v` - Value of the attribute

### XMLAttr

    public XMLAttr(java.lang.String name,
                   java.lang.String prefix,
                   java.lang.String qname,
                   java.lang.String namespace,
                   java.lang.String v)

  Deprecated. use crateAttribute(String) or createAttributeNS(String, String) of XMLDocument
  Private constructor (doesn't intern names)
  Parameters:
    `name` - Local name of the attribute
    `prefix` - Prefix of the attribute
    `qname` - Qname of the attribute
    `namespace` - Namespace of the attribute
    `v` - Value of the attribute

Method Detail

### getNodeType

    public short getNodeType()

  Gets a code representing the type of the underlying object
  Specified by:
    `getNodeType` in interface `Node`
  Overrides:
    `getNodeType` in class `XMLNode`
  Returns:
    type of the node

### getNodeName

    public java.lang.String getNodeName()

  Gets the name of this node, depending on its type
  Specified by:
    `getNodeName` in interface `Node`
  Overrides:
    `getNodeName` in class `XMLNode`
  Returns:
    Name of this node

### getName

    public java.lang.String getName()

  Gets the attribute name.
  Specified by:
    `getName` in interface `Attr`
  Returns:
    attribute name

### getLocalName

    public java.lang.String getLocalName()

  Gets the Local Name of this node
  Specified by:
    `getLocalName` in interface `NSName`
  Specified by:
    `getLocalName` in interface `Node`
  Overrides:
    `getLocalName` in class `XMLNode`
  Returns:
    LocalName of the node

### getNamespaceURI

    public java.lang.String getNamespaceURI()

  Gets the namespace URI of this node.
  Specified by:
    `getNamespaceURI` in interface `Node`
  Overrides:
    `getNamespaceURI` in class `XMLNode`
  Returns:
    the namespace

### getPrefix

    public java.lang.String getPrefix()

  Get the namespace prefix for this element.
  Specified by:
    `getPrefix` in interface `NSName`
  Specified by:
    `getPrefix` in interface `Node`
  Overrides:
    `getPrefix` in class `XMLNode`
  Returns:
    the namespace prefix

### setPrefix

    public void setPrefix(java.lang.String prefix)
                   throws DOMException

  Sets the prefix for attribute Note that setting the prefix, when permitted, changes the nodeName. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, prefix should always be null. Exceptions on setting DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character. NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns"
  Specified by:
    `setPrefix` in interface `Node`
  Overrides:
    `setPrefix` in class `XMLNode`
  Parameters:
    `prefix` - Sets the prefix of the node
  Throws:
    `DOMException` - if any DOM Exception occurs

### getValue

    public java.lang.String getValue()

  Gets the attribute value.
  Specified by:
    `getValue` in interface `Attr`
  Returns:
    attribute value

### getNodeValue

    public java.lang.String getNodeValue()
                                  throws DOMException

  Gets the value of this node, depending on its type
  Specified by:
    `getNodeValue` in interface `Node`
  Overrides:
    `getNodeValue` in class `XMLNode`
  Returns:
    Value of this node
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a `DOMString` variable on the implementation platform.

### setValue

    public void setValue(java.lang.String arg)
                  throws DOMException

  Sets the value.
  Specified by:
    `setValue` in interface `Attr`
  Parameters:
    `arg` - Value to set
  Throws:
    `DOMException`

### setNodeValue

    public void setNodeValue(java.lang.String nodeValue)
                      throws DOMException

  Sets the value of this node, depending on its type
  Specified by:
    `setNodeValue` in interface `Node`
  Overrides:
    `setNodeValue` in class `XMLNode`
  Parameters:
    `nodeValue` - the value of thenode to be set
  Throws:
    `DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a `DOMString` variable on the implementation platform.

### getParentNode

    public Node getParentNode()

  Gets 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`.
  Specified by:
    `getParentNode` in interface `Node`
  Overrides:
    `getParentNode` in class `XMLNode`
  Returns:
    The parent of this node

### getOwnerElement

    public Element getOwnerElement()

  Gets the element which owns this attribute
  Specified by:
    `getOwnerElement` in interface `Attr`
  Returns:
    the element node that owns this attribute

### getSpecified

    public boolean getSpecified()

  Returns true if the attribute was specified explicity in the element
  Specified by:
    `getSpecified` in interface `Attr`
  Returns:
    `true`, if the attribute was specified explicitly, `false`, if it was not

### getNextSibling

    public Node getNextSibling()

  Gets The node immediately following this node. If there is no such node, this returns `null`.
  Specified by:
    `getNextSibling` in interface `Node`
  Overrides:
    `getNextSibling` in class `XMLNode`
  Returns:
    the next node

### getPreviousSibling

    public Node getPreviousSibling()

  Gets the node immediately preceding this node. If there is no such node, this returns `null`.
  Specified by:
    `getPreviousSibling` in interface `Node`
  Overrides:
    `getPreviousSibling` in class `XMLNode`
  Returns:
    the previous node

### canRemoveChild

    public short canRemoveChild(Node oldChild)

  Determines whether the `Node.removeChild` operation would make this document not compliant with the `VAL_INCOMPLETE` validity type.
  Specified by:
    `canRemoveChild` in interface `NodeEditVAL`
  Overrides:
    `canRemoveChild` in class `XMLNode`
  Parameters:
    `oldChild` - `Node` to be removed.
  Returns:
    A validation state constant.

### getEnumeratedValues

    public DOMStringList getEnumeratedValues()

  A `DOMStringList`, as described in [DOM Level 3 Core] , of distinct values for an attribute or an element declaration or `null` if unspecified. If the schema is a W3C XML schema, this is a list of strings which are lexical representations corresponding to the values in the [value] property of the enumeration component for the type of the attribute or element. It is recommended that the canonical lexical representations of the values be used.
  Specified by:
    `getEnumeratedValues` in interface `NodeEditVAL`
  Overrides:
    `getEnumeratedValues` in class `XMLNode`

### getQualifiedName

    public java.lang.String getQualifiedName()

  Gets the qualified name for this attribute
  Specified by:
    `getQualifiedName` in interface `NSName`
  Returns:
    the qualified name

### getExpandedName

    public java.lang.String getExpandedName()

  Gets the fully resolved Name for this attribute
  Specified by:
    `getExpandedName` in interface `NSName`
  Returns:
    the fully resolved Name

### getNextAttribute

    public XMLAttr getNextAttribute()

  Gets the next attribute if any
  Returns:
    the next attribute

### addText

    public XMLNode addText(java.lang.String str)

  Append the given value to the attribute value
  Overrides:
    `addText` in class `XMLNSNode`
  Parameters:
    `str` - - text to be added

### getFirstChild

    public Node getFirstChild()

  Gets the first child of this node. If there is no such node, this returns `null`.
  Specified by:
    `getFirstChild` in interface `Node`
  Overrides:
    `getFirstChild` in class `XMLNSNode`
  Returns:
    The first child of this node

### getLastChild

    public Node getLastChild()

  Gets the last child of this node. If there is no such node, this returns `null`.
  Specified by:
    `getLastChild` in interface `Node`
  Overrides:
    `getLastChild` in class `XMLNSNode`
  Returns:
    The last child of this node

### getPrevAttribute

    public XMLAttr getPrevAttribute()

  Deprecated.
  Gets the prev attribute if any
  Returns:
    the prev attribute

Skip navigation links

Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01

Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.