Oracle® Application Server
XML Java API Reference
10g Release 2 (10.1.2)

Part no. B12024-03
September 2004

oracle.xdb.dom
Class XDBNode

java.lang.Object
  |
  +--oracle.xdb.dom.XDBNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
XDBAttribute, XDBCharData, XDBDocFragment, XDBDocument, XDBDocumentType, XDBElement, XDBEntity, XDBEntityReference, XDBNotation, XDBProcInst

public abstract class XDBNode
extends java.lang.Object
implements Node

This class implements the W3C DOM Node interface for interacting with XOBs.


Field Summary
protected  java.sql.Connection m_conn
           
protected  XDBDocument m_owner
           
protected  long m_xobcstate
           

 

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

 

Method Summary
 Node appendChild(Node arg)
          append the new child to the end of the child list; must be overriden by sub classes which support this method.
 Node cloneNode(boolean deep)
          Returns the copy of the node. the parent of the clone is set to null
 void close()
           
 boolean equals(java.lang.Object obj)
          Tests to see if the given object refers to the same node in the DOM tree as this.
 void finalize()
           
 NamedNodeMap getAttributes()
          Returns the attributes of the node.
 NodeList getChildNodes()
          Returns the nodelist of child nodes.
 java.lang.String getExpandedName()
          get the expanded name of the node
 Node getFirstChild()
          Returns the first child of the node. must be overriden derived classes which support this
 Node getLastChild()
          Returns the last child of the node. must be overriden derived classes which support this
 java.lang.String getLocalName()
          get the local name of the node
 java.lang.String getNamespaceURI()
          The namespace URI of this node, or null if it is unspecified.
 Node getNextSibling()
          Returns the next sibling of the node. must be overriden derived classes which support this
protected static Node getNodeFromCState(XDBDocument owner, long cstate)
           
 java.lang.String getNodeName()
          get the name of the node; sub classes need to override this method.
 short getNodeType()
          Returns the type of the node.
 java.lang.String getNodeValue()
          get the value of the node; sub classes which need to return valid values should override this method.
 Document getOwnerDocument()
          Returns the owner document of the node.
 Node getParentNode()
          Returns the parent of the node.
 java.lang.String getPrefix()
          The namespace prefix of this node, or null if it is unspecified.
 Node getPreviousSibling()
          Returns the previous sibling of the node. must be overriden derived classes which support this
 java.lang.String getQualifiedName()
          get the qualified name of the node
 Node getSchemaNode()
           
 boolean hasAttributes()
          tests if the node has attributes.
 boolean hasChildNodes()
          determines if the node has any children; sub classes must override this.
 int hashCode()
           
 Node insertBefore(Node newChild, Node refChild)
          Insert the newchild before the refchild; if refchild is null insert the newchild at the end of the child list.
protected  boolean isClosed()
           
 boolean isSupported(java.lang.String feature, java.lang.String version)
          test if a feature is supported in the given version
 void normalize()
          normalize
 Node removeChild(Node arg)
          remove the child from the childlist; must be overriden by sub classes which support this method.
 Node replaceChild(Node newChild, Node oldChild)
          replace the oldchild in the childlist with the newchild; must be overriden by sub classes which support this method.
 void setNodeValue(java.lang.String value)
          set the value of the node
 void setNodeXob(int propnum)
          Set the Xob state based on the owner document
 void setOwner(XDBDocument owner)
           
 void setPrefix(java.lang.String prefix)
           
 void setXobCstate(long xob)
           
 long toCState()
          Returns a long integer, which is actually the pointer to the underlying qmxob struct.
 java.lang.String toString()
           
 void write(java.io.OutputStream s, java.lang.String charEncoding, short indent)
          Writes the XML for this Node (and all subnodes) to an OutputStream.

 

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

 

Field Detail

m_owner

protected XDBDocument m_owner

m_xobcstate

protected long m_xobcstate

m_conn

protected java.sql.Connection m_conn
Method Detail

getNodeName

public java.lang.String getNodeName()
get the name of the node; sub classes need to override this method.
Specified by:
getNodeName in interface Node
Returns:
the node name string, always null for this node.

getNodeType

public short getNodeType()
Returns the type of the node. The node type i.e. document, element, etc. is defined in org.w3c.dom.Node
Specified by:
getNodeType in interface Node
Returns:
the type of the Node

getNodeValue

public java.lang.String getNodeValue()
get the value of the node; sub classes which need to return valid values should override this method.
Specified by:
getNodeValue in interface Node
Returns:
the node value string, always null for this node.

setNodeValue

public void setNodeValue(java.lang.String value)
                  throws DOMException
set the value of the node
Specified by:
setNodeValue in interface Node
Returns:
sub classes which have special handling should override this function
DOMException

getParentNode

public Node getParentNode()
Returns the parent of the node. Must be overridden by sub classes which are expected to support this.
Specified by:
getParentNode in interface Node
Returns:
the parent node

getSchemaNode

public Node getSchemaNode()

getChildNodes

public NodeList getChildNodes()
Returns the nodelist of child nodes. Sub classes must overrider this to return the appropriate child list.
Specified by:
getChildNodes in interface Node
Returns:
the child Nodelist of the node.

getLocalName

public java.lang.String getLocalName()
get the local name of the node
Specified by:
getLocalName in interface Node
Returns:
null for anything other than attribute and elem

getPrefix

public java.lang.String getPrefix()
Description copied from interface: Node
The namespace prefix of this node, or null if it is unspecified.
Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
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.
Specified by:
getPrefix in interface Node

setPrefix

public void setPrefix(java.lang.String prefix)
               throws DOMException
Specified by:
setPrefix in interface Node
DOMException

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.
Specified by:
getNamespaceURI in interface Node

getPreviousSibling

public Node getPreviousSibling()
Returns the previous sibling of the node. must be overriden derived classes which support this
Specified by:
getPreviousSibling in interface Node
Returns:
the previous node

getNextSibling

public Node getNextSibling()
Returns the next sibling of the node. must be overriden derived classes which support this
Specified by:
getNextSibling in interface Node
Returns:
the next node

getFirstChild

public Node getFirstChild()
Returns the first child of the node. must be overriden derived classes which support this
Specified by:
getFirstChild in interface Node
Returns:
the first child node

getLastChild

public Node getLastChild()
Returns the last child of the node. must be overriden derived classes which support this
Specified by:
getLastChild in interface Node
Returns:
the last child node

getAttributes

public NamedNodeMap getAttributes()
Returns the attributes of the node. If The node is not an element, returns null
Specified by:
getAttributes in interface Node
Returns:
the attribute map of the node.

hasAttributes

public boolean hasAttributes()
tests if the node has attributes.
Specified by:
hasAttributes in interface Node
Returns:
true or false.

getOwnerDocument

public Document getOwnerDocument()
Returns the owner document of the node.
Specified by:
getOwnerDocument in interface Node
Returns:
the document associated with the node.

insertBefore

public Node insertBefore(Node newChild,
Node refChild)
                  throws DOMException
Insert the newchild before the refchild; if refchild is null insert the newchild at the end of the child list. This method should be overriden by subclasses which support it.
Specified by:
insertBefore in interface Node
Returns:
the new child.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.

removeChild

public Node removeChild(Node arg)
                 throws DOMException
remove the child from the childlist; must be overriden by sub classes which support this method.
Specified by:
removeChild in interface Node
Returns:
the node being removed.
Throws:
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

replaceChild

public Node replaceChild(Node newChild,
Node oldChild)
                  throws DOMException
replace the oldchild in the childlist with the newchild; must be overriden by sub classes which support this method.
Specified by:
replaceChild in interface Node
Returns:
the node being replaced.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

appendChild

public Node appendChild(Node arg)
                 throws DOMException
append the new child to the end of the child list; must be overriden by sub classes which support this method.
Specified by:
appendChild in interface Node
Returns:
the node being appended.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

hasChildNodes

public boolean hasChildNodes()
determines if the node has any children; sub classes must override this.
Specified by:
hasChildNodes in interface Node
Returns:
true if node has child nodes

cloneNode

public Node cloneNode(boolean deep)
Returns the copy of the node. the parent of the clone is set to null
Specified by:
cloneNode in interface Node
Returns:
the new node

normalize

public void normalize()
normalize
Specified by:
normalize in interface Node
Returns:
void

isSupported

public boolean isSupported(java.lang.String feature,
                           java.lang.String version)
test if a feature is supported in the given version
Specified by:
isSupported in interface Node
Returns:
true or false

equals

public boolean equals(java.lang.Object obj)
Tests to see if the given object refers to the same node in the DOM tree as this. If obj is not an instance of XDBNode (or one of its descendents) this clearly this is always false. Example: If we have some node n, then n.getFirstChild() == n.getFirstChild() will evaluate to false, because a new Java object is instantiated with each call. However, since they do refer to the same node in the document tree, n.getFirstChild().equals(n.getFirstChild()) will evaluate to true.
Overrides:
equals in class java.lang.Object

toCState

public long toCState()
Returns a long integer, which is actually the pointer to the underlying qmxob struct. This method really should not be public, and is only a temporary workaround.
Returns:
the pointer to the underlying qmxob struct, typecast to a long

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

write

public void write(java.io.OutputStream s,
                  java.lang.String charEncoding,
                  short indent)
           throws java.io.IOException
Writes the XML for this Node (and all subnodes) to an OutputStream. If the OutputStream is a ServletOutputStream, the servlet output is committed and the data is written using a native stream mechanism.
Parameters:
s - The stream to write the output to
charEncoding - The IANA char code (e.g. "ISO-8859")
indent - Number of chars to indent nested elements
java.io.IOException

close

public void close()

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable

getQualifiedName

public java.lang.String getQualifiedName()
get the qualified name of the node
Returns:
the qualified node name string

getExpandedName

public java.lang.String getExpandedName()
get the expanded name of the node
Returns:
the expanded node name string

setOwner

public void setOwner(XDBDocument owner)

setXobCstate

public void setXobCstate(long xob)

isClosed

protected boolean isClosed()

getNodeFromCState

protected static Node getNodeFromCState(XDBDocument owner,
                                        long cstate)

setNodeXob

public void setNodeXob(int propnum)
Set the Xob state based on the owner document

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Oracle® Application Server
XML Java API Reference
10g Release 2 (10.1.2)

Part no. B12024-03
September 2004

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