oracle.xml.parser.v2
Class XMLAttr

oracle.xml.parser.v2.XMLAttr

public class XMLAttr
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

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)
          Construct attribute with given name and value.
XMLAttr(java.lang.String name, java.lang.String prefix, java.lang.String namespace, java.lang.String v)
          Namespace support
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
 XMLNode addText(java.lang.String str)
           
 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
protected  XMLElement getSrcRoot()
          Gets the top most ancestor of this node used for XPath evaluation
 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.
 

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)
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)
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
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
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.
Returns:
the namespace URI associated with this attribute
Since:
DOM 2

getLocalName

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

getPrefix

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

setPrefix

public void setPrefix(java.lang.String p)
Sets the prefix of this node
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
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.
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

getSrcRoot

protected XMLElement getSrcRoot()
Gets the top most ancestor of this node used for XPath evaluation
Returns:
XMLElement

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
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.
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)

getNextSibling

public Node getNextSibling()
Description copied from interface: Node
The node immediately following this node. If there is no such node, this returns null.

getPreviousSibling

public Node getPreviousSibling()
Description copied from interface: Node
The node immediately preceding this node. If there is no such node, this returns null.

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
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
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
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


 

Copyright © 1997, 2004, Oracle. All rights reserved.