oracle.xml.parser.v2
Class XMLNSNode

java.lang.Object
  |
  +--oracle.xml.parser.v2.XMLNode
        |
        +--oracle.xml.parser.v2.XMLNSNode
Direct Known Subclasses:
XMLAttr, XMLElement, XMLEntity, XMLEntityReference

public class XMLNSNode
extends XMLNode

Extends XMLNode to add support for Namespace names and children

See Also:
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
 
Constructor Summary
TypeConstructor
protected XMLNSNode(java.lang.String tag)
          Constructs a new XMLNSNode having the given name and type
 
Method Summary
TypeMethod
 void addText(char[] ch, int start, int length)
          Adds text to this node, or appends str to the last child if the last child is a text node.
 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 appendChild(Node newChildArg)
          Adds the node newChild to the end of the list of children of this node.
 NodeList getChildNodes()
          Gets a NodeList that contains all children of this node.
 Node getFirstChild()
          Gets the first child of this node.
 Node getLastChild()
          Gets the last child of this node.
 java.lang.String getLocalName()
          Returns the local part of the qualified name of this node.
 java.lang.String getNamespaceURI()
          The namespace URI of this node, or null if it is unspecified.
 java.lang.String getNodeLocalName()
           
 java.lang.String getNodeName()
          Gets the name of this node, depending on its type
 java.lang.String getNodePrefix()
           
 java.lang.String getPrefix()
          The namespace prefix of this node, or null if it is unspecified.
 java.lang.String getText()
          Returns the non-marked-up text contained by this element.
 boolean hasChildNodes()
          This is a convenience method to allow easy determination of whether a node has any children.
 Node insertBefore(Node newChildArg, Node refChildArg)
          Inserts the node newChild before the existing child node refChild.
 void normalize()
          Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 Node removeChild(Node oldChildArg)
          Removes the child node indicated by oldChild from the list of children, and returns it.
 Node replaceChild(Node newChildArg, Node oldChildArg)
          Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 void setPrefix(java.lang.String prefix)
           
 
Methods inherited from class oracle.xml.parser.v2.XMLNode
addEventListener, cloneNode, dispatchEvent, getAttributes, getColumnNumber, getDebugMode, getLineNumber, getNamespace, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, getProperty, getSystemId, hasAttributes, isNodeFlag, isSupported, print, print, print, readChildNodes, readExternal, readExternal, removeEventListener, reportSAXEvents, resetNodeFlag, selectNodes, selectNodes, selectNodes, selectSingleNode, selectSingleNode, setDebugInfo, setNodeFlag, setNodeValue, setProperty, supports, transformNode, valueOf, valueOf, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLNSNode

protected XMLNSNode(java.lang.String tag)
Constructs a new XMLNSNode having the given name and type
Parameters:
tag - Name of the node
Method Detail

getNodeName

public java.lang.String getNodeName()
Gets the name of this node, depending on its type
Overrides:
getNodeName in class XMLNode
Returns:
Name of this node

getChildNodes

public NodeList getChildNodes()
Gets a NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node. This is true for every NodeList, including the ones returned by the getElementsByTagName method.
Overrides:
getChildNodes in class XMLNode
Returns:
The children of this node

getFirstChild

public Node getFirstChild()
Gets the first child of this node. If there is no such node, this returns null.
Overrides:
getFirstChild in class XMLNode
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.
Overrides:
getLastChild in class XMLNode
Returns:
The last child of this node

insertBefore

public Node insertBefore(Node newChildArg,
                         Node refChildArg)
                  throws DOMException
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.
Overrides:
insertBefore in class XMLNode
Parameters:
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
Returns:
The node being inserted.
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.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.

replaceChild

public Node replaceChild(Node newChildArg,
                         Node oldChildArg)
                  throws DOMException
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. If the newChild is already in the tree, it is first removed.
Overrides:
replaceChild in class XMLNode
Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node 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 it 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 is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

removeChild

public Node removeChild(Node oldChildArg)
                 throws DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.
Overrides:
removeChild in class XMLNode
Parameters:
oldChild - The node being removed.
Returns:
The node 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.

appendChild

public Node appendChild(Node newChildArg)
                 throws DOMException
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.
Overrides:
appendChild in class XMLNode
Parameters:
newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
Returns:
The node added.
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()
This is a convenience method to allow easy determination of whether a node has any children.
Overrides:
hasChildNodes in class XMLNode
Returns:
true if the node has any children, false if the node has no children.

getText

public java.lang.String getText()
Returns the non-marked-up text contained by this element. For text elements, this is the raw data. For elements with child nodes, this method traverses the entire subtree and appends the text for each terminal text element, effectively stripping out the XML markup for the subtree. For example, if the XML document contains the following: <AUTHOR> <FIRST>William</FIRST> <LAST>Shakespeare</LAST> </AUTHOR>

XMLDocument.getText returns "William Shakespeare".

Overrides:
getText in class XMLNode
Returns:
non-marked-up text contained bu this element

addText

public XMLNode addText(java.lang.String str)
                throws XMLDOMException
Adds text to this node, or appends str to the last child if the last child is a text node.
Parameters:
str - text to add
Throws:
XMLDOMException - if text can't be added to this node

addText

public void addText(char[] ch,
                    int start,
                    int length)
             throws XMLDOMException
Adds text to this node, or appends str to the last child if the last child is a text node.
Parameters:
ch - char array to add
start - start index in the char array
length - no of chars to be added
Throws:
XMLDOMException - if text can't be added to this node

normalize

public void normalize()
Description copied from interface: Node
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes.
Overrides:
normalize in class XMLNode
Since:
DOM 2 Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes,i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particulardocument tree structure are to be used.

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 XMLNode
Since:
DOM 2 gets the namespace URI of this node. overrided by node types for which namespace is meaningful.

getNodePrefix

public java.lang.String getNodePrefix()
Overrides:
getNodePrefix in class XMLNode
Since:
DOM 2 gets the prefix of this node overrided by node types for which namespace is meaningful.

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.
Overrides:
getPrefix in class XMLNode
Tags copied from interface: Node
Throws:
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" .

setPrefix

public void setPrefix(java.lang.String prefix)
               throws DOMException
Overrides:
setPrefix in class XMLNode
Since:
DOM 2 sets the prefix of this node overrided by node types for which namespace is meaningful.

getNodeLocalName

public java.lang.String getNodeLocalName()
Overrides:
getNodeLocalName in class XMLNode
Since:
DOM 2 gets the Local Name of this node overrided by node types for which namespace is meaningful.

getLocalName

public java.lang.String getLocalName()
Description copied from interface: Node
Returns the local part of the qualified name of this node.
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.
Overrides:
getLocalName in class XMLNode