oracle.xml.parser.v2
Class XMLAttr

java.lang.Object
  |
  +--oracle.xml.parser.v2.XMLNode
        |
        +--oracle.xml.parser.v2.XMLNSNode
              |
              +--oracle.xml.parser.v2.XMLAttr

public class XMLAttr
extends XMLNSNode
implements Attr, NSName, java.io.Externalizable, CXMLConstants

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

Fields inherited from class oracle.xml.parser.v2.XMLNode
ATTRDECL, Auto_Events, capturing, DOMAttrModified, DOMCharacterDataModified, DOMNodeInserted, DOMNodeInsertedIntoDocument, DOMNodeRemoved, DOMNodeRemovedFromDocument, DOMSubtreeModified, ELEMENTDECL, noncapturing, RANGE_DELETE_EVENT, RANGE_DELETETEXT_EVENT, RANGE_INSERT_EVENT, RANGE_INSERTTEXT_EVENT, RANGE_REPLACE_EVENT, RANGE_SETTEXT_EVENT, TRAVERSAL_DELETE_EVENT, TRAVERSAL_REPLACE_EVENT, XMLDECL_NODE
 
Fields inherited from interface oracle.xml.comp.CXMLConstants
ATTR_DEF, ATTR_TOKEN, ATTRDECL_DEF, CDATA_DEF, CHAR_DEF, COMMENT_DEF, CXML_VERSION, cXMLFILE, cXMLFILE_LEN, DEBUG, DTD_DEF, ELEMENTDECL_DEF, END, ENTITY_DEF, ENTITYREF_DEF, META_ID_MAX, names, NOTATION_DEF, NS_DEF, NULLSTR, PI_DEF, PREFIX_DEF, TAG_DEF, TAG_TOKEN, TOKEN_ONLY, XMLDECL_DEF
 
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
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 namespace, java.lang.String v, boolean isLevelTwo)
           
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
 
Method Summary
TypeMethod
 XMLNode addText(java.lang.String str)
          Adds text to this node, or appends str to the last child if the last child is a text node.
 Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
 java.lang.String getExpandedName()
          Get the fully resolved Name for this attribute
 java.lang.String getLocalName()
          gets the local name of this attribute
 java.lang.String getName()
          Gets the attribute name.
 java.lang.String getNamespace()
          Deprecated. As of DOM 2
 java.lang.String getNamespaceURI()
          The namespace URI of this node, or null if it is unspecified.
 XMLAttr getNextAttribute()
          returns the next attribute if any
 Node getNextSibling()
          The node immediately following this node.
 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()
          The Element node this attribute is attached to or null if this attribute is not in use.
 Node getParentNode()
          Gets the parent of this node.
 java.lang.String getPrefix()
          gets the name space prefix of the element
 Node getPreviousSibling()
          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 readExternal(java.io.ObjectInput inArg)
          This method restores the information written by writeExternal.
 void readExternal(oracle.xml.io.XMLObjectInput in, oracle.xml.comp.CXMLContext cxmlContext)
          This method reads the attribute information from the compressed stream
 void setNodeValue(java.lang.String nodeValue)
          Sets the value of this node, depending on its type
 void setPrefix(java.lang.String p)
          Sets the prefix of this node
 void setValue(java.lang.String arg)
          Sets the value.
 void writeExternal(java.io.ObjectOutput outArg)
          This method saves the state of the object.
 
Methods inherited from class oracle.xml.parser.v2.XMLNSNode
addText, appendChild, getChildNodes, getFirstChild, getLastChild, getNodeLocalName, getNodeName, getNodePrefix, getText, hasChildNodes, insertBefore, normalize, removeChild, replaceChild
 
Methods inherited from class oracle.xml.parser.v2.XMLNode
addEventListener, dispatchEvent, getAttributes, getColumnNumber, getDebugMode, getLineNumber, getOwnerDocument, getProperty, getSystemId, hasAttributes, isNodeFlag, isSupported, print, print, print, readChildNodes, removeEventListener, reportSAXEvents, resetNodeFlag, selectNodes, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setProperty, supports, transformNode, valueOf, valueOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 namespace,
               java.lang.String v,
               boolean isLevelTwo)

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
Overrides:
getNodeType in class XMLNode
Returns:
type of the node

getName

public java.lang.String getName()
Gets the attribute name.
Specified by:
getName in interface Attr
Returns:
attribute name

getQualifiedName

public java.lang.String getQualifiedName()
Gets the qualified name for this attribute
Returns:
the qualified name

getNamespace

public java.lang.String getNamespace()
Deprecated. As of DOM 2

Get the resolved Namespace for this attribute
Overrides:
getNamespace in class XMLNode
Returns:
the resolved Namespace
See Also:
getNamespaceURI()

getNamespaceURI

public java.lang.String getNamespaceURI()
Description copied from interface: Node
The namespace URI of this node, or null if it is unspecified.
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
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, this is always null.Per the Namespaces in XML Specification an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.
Overrides:
getNamespaceURI in class XMLNSNode
Returns:
the namespace URI associated with this attribute
Since:
DOM 2

getLocalName

public java.lang.String getLocalName()
gets the local name of this attribute
Overrides:
getLocalName in class XMLNSNode
Returns:
the local Name for this attribute
Since:
DOM 2

getPrefix

public java.lang.String getPrefix()
gets the name space prefix of the element
Overrides:
getPrefix in class XMLNSNode
Returns:
the namespace prefix for this attribute
Since:
DOM 2

setPrefix

public void setPrefix(java.lang.String p)
Sets the prefix of this node
Overrides:
setPrefix in class XMLNSNode
Parameters:
p - Sets the prefix of the node
Since:
DOM 2

getExpandedName

public java.lang.String getExpandedName()
Get the fully resolved Name for this attribute
Returns:
the fully resolved Name

getNodeValue

public java.lang.String getNodeValue()
                              throws DOMException
Gets the value of this node, depending on its type
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.

getValue

public java.lang.String getValue()
Gets the attribute value.
Specified by:
getValue in interface Attr
Returns:
attribute value

setValue

public void setValue(java.lang.String arg)
              throws DOMException
Sets the value.
Specified by:
setValue in interface Attr
Parameters:
arg - Value to set

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.
Overrides:
getParentNode in class XMLNode
Returns:
The parent of this node

getNextAttribute

public XMLAttr getNextAttribute()
returns the next attribute if any
Returns:
the next attribute

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
Returns:
the element node that owns this attribute
Since:
DOM 2 returns the element which 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

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws DOMException
Sets the value of this node, depending on its type
Overrides:
setNodeValue in class XMLNode
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.

cloneNode

public Node cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode returns null.).
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
Overrides:
cloneNode in class XMLNode
Parameters:
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
Returns:
The duplicate node.

addText

public XMLNode addText(java.lang.String str)
Description copied from class: XMLNSNode
Adds text to this node, or appends str to the last child if the last child is a text node.
Overrides:
addText in class XMLNSNode
Tags copied from class: XMLNSNode
Parameters:
str - text to add
Throws:
XMLDOMException - if text can't be added to this node

getNextSibling

public Node getNextSibling()
Description copied from interface: Node
The node immediately following this node. If there is no such node, this returns null.
Overrides:
getNextSibling in class XMLNode
Tags copied from class: XMLNode
Returns:
the next node

getPreviousSibling

public Node getPreviousSibling()
Description copied from interface: Node
The node immediately preceding this node. If there is no such node, this returns null.
Overrides:
getPreviousSibling in class XMLNode
Tags copied from class: XMLNode
Returns:
the previous node

writeExternal

public void writeExternal(java.io.ObjectOutput outArg)
                   throws java.io.IOException
This method saves the state of the object. The object information is saved in a binary compressed stream.
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class XMLNode
Parameters:
out - The ObjectOutput stream used to write the compressed stream
Throws:
java.io.IOException - is thrown when there is an exception while writing the compressed stream.

readExternal

public void readExternal(java.io.ObjectInput inArg)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
This method restores the information written by writeExternal.
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class XMLNode
Parameters:
in - is the ObjectInput stream used to read the compressed stream
Throws:
java.io.IOException - is thrown when there is an exception while reading the compressed stream.
java.lang.ClassNotFoundException - is thrown when the class is not found

readExternal

public void readExternal(oracle.xml.io.XMLObjectInput in,
                         oracle.xml.comp.CXMLContext cxmlContext)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
This method reads the attribute information from the compressed stream
Overrides:
readExternal in class XMLNode
Parameters:
in - is the XMLObjectInput stream used to read the compressed stream
Throws:
java.io.IOException - is thrown when there is an exception while reading the compressed stream.
java.lang.ClassNotFoundException - is thrown when the class is not found