Xindice API

org.apache.xindice.xml.dom
Class NodeImpl

java.lang.Object
  |
  +--org.apache.xindice.xml.dom.NodeImpl
All Implemented Interfaces:
CompressedNode, DBNode, org.w3c.dom.Node
Direct Known Subclasses:
CharacterDataImpl, ContainerNodeImpl, DocumentTypeImpl, EntityImpl, EntityReferenceImpl, NotationImpl, ProcessingInstructionImpl

public abstract class NodeImpl
extends java.lang.Object
implements CompressedNode, DBNode

NodeImpl implements the foundation of the Xindice compressed DOM.


Field Summary
static org.w3c.dom.DOMException EX_DOMSTRING_SIZE
           
static org.w3c.dom.DOMException EX_HIERARCHY_REQUEST
           
static org.w3c.dom.DOMException EX_INDEX_SIZE
           
static org.w3c.dom.DOMException EX_INUSE_ATTRIBUTE
           
static org.w3c.dom.DOMException EX_INVALID_STATE
           
static org.w3c.dom.DOMException EX_NO_DATA_ALLOWED
           
static org.w3c.dom.DOMException EX_NO_MODIFICATION_ALLOWED
           
static org.w3c.dom.DOMException EX_NOT_FOUND
           
static org.w3c.dom.DOMException EX_WRONG_DOCUMENT
           
static java.lang.String OBJECT_HREF
           
static java.lang.String OBJECT_NS
           
static java.lang.String OBJECT_TYPE
           
static java.lang.String TYPE_APPEND
           
static java.lang.String TYPE_CONTENT
           
static java.lang.String TYPE_INSERT
           
static java.lang.String TYPE_REPLACE
           
static java.lang.String XMLNS_PREFIX
           
 
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
NodeImpl()
           
NodeImpl(byte[] data, int pos, int len)
           
NodeImpl(NodeImpl parentNode, boolean dirty)
           
NodeImpl(NodeImpl parentNode, byte[] data, int pos, int len)
           
 
Method Summary
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          Adds the node newChild to the end of the list of children of this node.
 void checkReadOnly()
           
 org.w3c.dom.Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
 void expandSource()
          expandSource expands the source into the Node as a namespace and a set of attributes.
 org.w3c.dom.NamedNodeMap getAttributes()
          A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
 org.w3c.dom.NodeList getChildNodes()
          A NodeList that contains all children of this node.
 byte[] getDataBytes()
          getDataBytes returns the byte array that defines this Node.
 int getDataLen()
          getDataLen returns the length of the Node's definition in the byte array.
 int getDataPos()
          getDataPos returns the offset into the Node definition's byte array that the Node starts at.
 org.w3c.dom.Node getFirstChild()
          The first child of this node.
 java.lang.Object getKey()
          This attribute returns a unique key identifying this node.What type should this really be?In what space is this key unique (Document, DOMImplementation)?What is the lifetime of the uniqueness of this key (Node, Document, ...)?
 org.w3c.dom.Node getLastChild()
          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.
 org.w3c.dom.Node getNextSibling()
          The node immediately following this node.
 java.lang.String getNodeName()
          The name of this node, depending on its type; see the table above.
abstract  short getNodeType()
          A code representing the type of the underlying object, as defined above.
 java.lang.String getNodeValue()
          The value of this node, depending on its type; see the table above.
 org.w3c.dom.Document getOwnerDocument()
          The Document object associated with this node.
 org.w3c.dom.Node getParentNode()
          The parent of this node.
 java.lang.String getPrefix()
          The namespace prefix of this node, or null if it is unspecified.
 org.w3c.dom.Node getPreviousSibling()
          The node immediately preceding this node.
 NodeSource getSource()
          getSource returns a source for this Node.
 short getSymbolID()
          getSymbolID returns the Symbol ID for the current node.
 java.lang.Object getUserData(java.lang.String key)
          This method allows to retreive a user object previously attached to a Node with setUserData.
 boolean hasAttributes()
           
 boolean hasChildNodes()
          This is a convenience method to allow easy determination of whether a node has any children.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
          Inserts the node newChild before the existing child node refChild.
 boolean isDefined()
           
 boolean isDirty()
          isDirty returns whether or not the current Node (or any of its children) have been modified since being loaded.
 boolean isLoaded()
          isLoaded returns whether or not the Node's definition has been loaded.
 boolean isSameNode(org.w3c.dom.Node other)
          Returns whether this node is the same node as the given one.
 boolean isSupported(java.lang.String feature, java.lang.String version)
          Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
 void load()
          load forces the Node to be graphed for this level.
 java.lang.String lookupDefaultNamespaceURI()
          getDefaultNamespaceURI returns the default Namespace URI in this scope.
 java.lang.String lookupNamespacePrefix(java.lang.String namespaceURI)
          Look up the prefix associated to the given namespace URI, starting from this node.
 java.lang.String lookupNamespaceURI(java.lang.String prefix)
          Look up the namespace URI associated to the given prefix, starting from this node.Name? May need to change depending on ending of the relative namespace URI reference nightmare.
 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 markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 void normalizeNS()
          This method walks down the tree, starting from this node, and adds namespace declarations where needed so that every namespace being used is properly declared.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          Removes the child node indicated by oldChild from the list of children, and returns it.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
          Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 void setDataBytes(byte[] data)
          setDataBytes sets the byte array that defines this Node.
 void setDataBytes(byte[] data, int pos, int len)
          setDataBytes sets the definition and positional information for the Node.
 void setDataLen(int len)
          setDataLen sets the length of the Node's definition in the byte array.
 void setDataPos(int pos)
          setDataPos sets the offset into the Node definition's byte array that the Node starts at.
 void setDirty()
           
 void setNodeName(java.lang.String nodeName)
           
 void setNodeValue(java.lang.String nodeValue)
          The value of this node, depending on its type; see the table above.
 void setParentNode(NodeImpl parentNode)
           
 void setPrefix(java.lang.String prefix)
          The namespace prefix of this node, or null if it is unspecified.
 void setSource(NodeSource source)
          setSource sets a source for this Node.
 java.lang.Object setUserData(java.lang.Object data, java.lang.String key)
          This method allows to attach a user object to a Node.
 void unload()
          unload forces the Node to be unloaded for this level.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_PREFIX

public static final java.lang.String XMLNS_PREFIX

OBJECT_NS

public static final java.lang.String OBJECT_NS

OBJECT_HREF

public static final java.lang.String OBJECT_HREF

OBJECT_TYPE

public static final java.lang.String OBJECT_TYPE

TYPE_CONTENT

public static final java.lang.String TYPE_CONTENT

TYPE_REPLACE

public static final java.lang.String TYPE_REPLACE

TYPE_INSERT

public static final java.lang.String TYPE_INSERT

TYPE_APPEND

public static final java.lang.String TYPE_APPEND

EX_NO_MODIFICATION_ALLOWED

public static final org.w3c.dom.DOMException EX_NO_MODIFICATION_ALLOWED

EX_INUSE_ATTRIBUTE

public static final org.w3c.dom.DOMException EX_INUSE_ATTRIBUTE

EX_WRONG_DOCUMENT

public static final org.w3c.dom.DOMException EX_WRONG_DOCUMENT

EX_NOT_FOUND

public static final org.w3c.dom.DOMException EX_NOT_FOUND

EX_HIERARCHY_REQUEST

public static final org.w3c.dom.DOMException EX_HIERARCHY_REQUEST

EX_NO_DATA_ALLOWED

public static final org.w3c.dom.DOMException EX_NO_DATA_ALLOWED

EX_INVALID_STATE

public static final org.w3c.dom.DOMException EX_INVALID_STATE

EX_DOMSTRING_SIZE

public static final org.w3c.dom.DOMException EX_DOMSTRING_SIZE

EX_INDEX_SIZE

public static final org.w3c.dom.DOMException EX_INDEX_SIZE
Constructor Detail

NodeImpl

public NodeImpl()

NodeImpl

public NodeImpl(byte[] data,
                int pos,
                int len)

NodeImpl

public NodeImpl(NodeImpl parentNode,
                byte[] data,
                int pos,
                int len)

NodeImpl

public NodeImpl(NodeImpl parentNode,
                boolean dirty)
Method Detail

isLoaded

public final boolean isLoaded()
Description copied from interface: CompressedNode
isLoaded returns whether or not the Node's definition has been loaded.
Specified by:
isLoaded in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
Whether or not the Node is loaded

load

public void load()
Description copied from interface: CompressedNode
load forces the Node to be graphed for this level. Loading happens automatically whenever a Node's children are accessed, so load should never have to explicitly be called.
Specified by:
load in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Throws:
org.w3c.dom.DOMException - if an exception occurs

unload

public void unload()
Description copied from interface: CompressedNode
unload forces the Node to be unloaded for this level. Whether the node is actually unloaded or not is up to the underlying implementation, and should silently fail if the implementation doesn't support unloading.
Specified by:
unload in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Throws:
org.w3c.dom.DOMException - if an exception occurs

getSymbolID

public short getSymbolID()
Description copied from interface: CompressedNode
getSymbolID returns the Symbol ID for the current node. Some nodes will not have a Symbol ID, in which case, a value of -1 is returned.
Specified by:
getSymbolID in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Symbol ID

checkReadOnly

public final void checkReadOnly()
                         throws org.w3c.dom.DOMException

isDefined

public final boolean isDefined()

isDirty

public final boolean isDirty()
Description copied from interface: CompressedNode
isDirty returns whether or not the current Node (or any of its children) have been modified since being loaded.
Specified by:
isDirty in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
Whether or not the Node has been modified

setDirty

public final void setDirty()

getDataBytes

public byte[] getDataBytes()
Description copied from interface: CompressedNode
getDataBytes returns the byte array that defines this Node. A Node definition is usually a subset of this byte array.
Specified by:
getDataBytes in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Node definition's byte array

setDataBytes

public void setDataBytes(byte[] data,
                         int pos,
                         int len)
Description copied from interface: CompressedNode
setDataBytes sets the definition and positional information for the Node.
Specified by:
setDataBytes in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
data - The Node definition's byte array
pos - The Node's position
len - The Node's length

setDataBytes

public void setDataBytes(byte[] data)
Description copied from interface: CompressedNode
setDataBytes sets the byte array that defines this Node.
Specified by:
setDataBytes in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
data - The Node definition's byte array

getDataPos

public int getDataPos()
Description copied from interface: CompressedNode
getDataPos returns the offset into the Node definition's byte array that the Node starts at.
Specified by:
getDataPos in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Node's position

setDataPos

public void setDataPos(int pos)
Description copied from interface: CompressedNode
setDataPos sets the offset into the Node definition's byte array that the Node starts at.
Specified by:
setDataPos in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
pos - The Node's position

getDataLen

public int getDataLen()
Description copied from interface: CompressedNode
getDataLen returns the length of the Node's definition in the byte array.
Specified by:
getDataLen in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Returns:
The Node's length

setDataLen

public void setDataLen(int len)
Description copied from interface: CompressedNode
setDataLen sets the length of the Node's definition in the byte array.
Specified by:
setDataLen in interface CompressedNode
Following copied from interface: org.apache.xindice.xml.dom.CompressedNode
Parameters:
len - The Node's length

setNodeName

public final void setNodeName(java.lang.String nodeName)

setParentNode

public final void setParentNode(NodeImpl parentNode)

setSource

public final void setSource(NodeSource source)
Description copied from interface: DBNode
setSource sets a source for this Node.
Specified by:
setSource in interface DBNode
Following copied from interface: org.apache.xindice.xml.dom.DBNode
Parameters:
source - The Document source
Throws:
org.w3c.dom.DOMException - if an exception occurs

getSource

public final NodeSource getSource()
Description copied from interface: DBNode
getSource returns a source for this Node.
Specified by:
getSource in interface DBNode
Following copied from interface: org.apache.xindice.xml.dom.DBNode
Returns:
The Document source

expandSource

public void expandSource()
Description copied from interface: DBNode
expandSource expands the source into the Node as a namespace and a set of attributes. This method will only work on a Document or an Element, and should silently fail on all other Node types.
Specified by:
expandSource in interface DBNode

getNodeType

public abstract short getNodeType()
A code representing the type of the underlying object, as defined above.
Specified by:
getNodeType in interface org.w3c.dom.Node

getLastChild

public org.w3c.dom.Node getLastChild()
The last child of this node. If there is no such node, this returns null.
Specified by:
getLastChild in interface org.w3c.dom.Node

getPreviousSibling

public final org.w3c.dom.Node getPreviousSibling()
The node immediately preceding this node. If there is no such node, this returns null.
Specified by:
getPreviousSibling in interface org.w3c.dom.Node

getNextSibling

public final org.w3c.dom.Node getNextSibling()
The node immediately following this node. If there is no such node, this returns null.
Specified by:
getNextSibling in interface org.w3c.dom.Node

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
Specified by:
getAttributes in interface org.w3c.dom.Node

hasAttributes

public boolean hasAttributes()
Specified by:
hasAttributes in interface org.w3c.dom.Node

getOwnerDocument

public final org.w3c.dom.Document getOwnerDocument()
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document this is null.
Specified by:
getOwnerDocument in interface org.w3c.dom.Node

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.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.
Specified by:
insertBefore in interface org.w3c.dom.Node
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:
org.w3c.dom.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.

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
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.
Specified by:
getChildNodes in interface org.w3c.dom.Node

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws org.w3c.dom.DOMException
The value of this node, depending on its type; see the table above. When it is defined to be null , setting it has no effect.
Specified by:
setNodeValue in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
org.w3c.dom.DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

getParentNode

public final org.w3c.dom.Node getParentNode()
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 org.w3c.dom.Node

getFirstChild

public org.w3c.dom.Node getFirstChild()
The first child of this node. If there is no such node, this returns null.
Specified by:
getFirstChild in interface org.w3c.dom.Node

getNodeName

public java.lang.String getNodeName()
The name of this node, depending on its type; see the table above.
Specified by:
getNodeName in interface org.w3c.dom.Node

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
The value of this node, depending on its type; see the table above.
Specified by:
getNodeValue in interface org.w3c.dom.Node
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
org.w3c.dom.DOMException - DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.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.
Specified by:
replaceChild in interface org.w3c.dom.Node
Parameters:
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
Returns:
The node replaced.
Throws:
org.w3c.dom.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 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.
Specified by:
removeChild in interface org.w3c.dom.Node
Parameters:
oldChild - The node being removed.
Returns:
The node removed.
Throws:
org.w3c.dom.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 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.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.
Specified by:
appendChild in interface org.w3c.dom.Node
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:
org.w3c.dom.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.
Specified by:
hasChildNodes in interface org.w3c.dom.Node
Returns:
true if the node has any children, false if the node has no children.

cloneNode

public final org.w3c.dom.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.
Specified by:
cloneNode in interface org.w3c.dom.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.

normalize

public 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 markup (e.g., tags, 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.
Specified by:
normalize in interface org.w3c.dom.Node
Since:
DOM Level 2

isSupported

public final boolean isSupported(java.lang.String feature,
                                 java.lang.String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Specified by:
isSupported in interface org.w3c.dom.Node
Parameters:
feature - The name of the feature to test. This is the same name which can be passed to the method hasFeature on DOMImplementation .
version - This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to return true .
Returns:
Returns true if the specified feature is supported on this node, false otherwise.
Since:
DOM Level 2

getNamespaceURI

public final java.lang.String getNamespaceURI()
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 org.w3c.dom.Node
Since:
DOM Level 2

getPrefix

public final java.lang.String getPrefix()
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.
Specified by:
getPrefix in interface org.w3c.dom.Node
Throws:
org.w3c.dom.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" .
Since:
DOM Level 2

setPrefix

public final void setPrefix(java.lang.String prefix)
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.
Specified by:
setPrefix in interface org.w3c.dom.Node
Throws:
org.w3c.dom.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" .
Since:
DOM Level 2

getLocalName

public final java.lang.String getLocalName()
Returns the local part of the qualified name of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null .
Specified by:
getLocalName in interface org.w3c.dom.Node
Since:
DOM Level 2

lookupDefaultNamespaceURI

public final java.lang.String lookupDefaultNamespaceURI()
getDefaultNamespaceURI returns the default Namespace URI in this scope.
Returns:
The URI (or null)

isSameNode

public final boolean isSameNode(org.w3c.dom.Node other)
Returns whether this node is the same node as the given one. Do we really want to make this different from equals?Yes, change name from isIdentical to isSameNode. (Telcon 4 Jul 2000).
Parameters:
otherThe - node to test against.
Returns:
Returns true if the nodes are the same, false otherwise.

lookupNamespacePrefix

public final java.lang.String lookupNamespacePrefix(java.lang.String namespaceURI)
Look up the prefix associated to the given namespace URI, starting from this node.
Parameters:
namespaceURIThe - namespace URI to look for.
Returns:
Returns the associated namespace prefix or null if none is found.

lookupNamespaceURI

public final java.lang.String lookupNamespaceURI(java.lang.String prefix)
Look up the namespace URI associated to the given prefix, starting from this node.Name? May need to change depending on ending of the relative namespace URI reference nightmare.
Parameters:
prefixThe - prefix to look for.
Returns:
Returns the associated namespace URI or null if none is found.

normalizeNS

public void normalizeNS()
                 throws org.w3c.dom.DOMException
This method walks down the tree, starting from this node, and adds namespace declarations where needed so that every namespace being used is properly declared. It also changes or assign prefixes when needed. This effectively makes this node subtree is "namespace wellformed".
What the generated prefixes are and/or how prefixes are changed to achieve this is implementation dependent.Any other name?How specific should this be? Should we not even specify that this should be done by walking down the tree?What does this do on attribute nodes?Doesn't do anything (F2F 1 Aug 2000).How does it work with entity reference subtree which may be broken?This doesn't affect entity references which are not visited in this operation (F2F 1 Aug 2000).Should this be really be on Node?Yes, but this only works on Document, Element, and DocumentFragment. On other types it is a no-op. (F2F 1 Aug 2000). What happens with read-only nodes?What/how errors should be reported? Are there any?

setUserData

public final java.lang.Object setUserData(java.lang.Object data,
                                          java.lang.String key)
This method allows to attach a user object to a Node. This object can then be retreived using getUserData.Is this really worth it?Could we live without a key?What happens if the node is cloned, imported, adopted? Should some event mechanism be specified to notify the application?What happens if the node is cloned?What should Object be mapped to in ECMAScript? For IDL we need to define this type somehow.
Parameters:
dataThe - piece of data to attach to this node.
keyThe - key to associate this data to.
Returns:
The object previously associated to this node and the given key or null.

getUserData

public final java.lang.Object getUserData(java.lang.String key)
This method allows to retreive a user object previously attached to a Node with setUserData.
Parameters:
keyThe - key to look for.
Returns:
The object associated to this node and the given key or null.

getKey

public final java.lang.Object getKey()
This attribute returns a unique key identifying this node.What type should this really be?In what space is this key unique (Document, DOMImplementation)?What is the lifetime of the uniqueness of this key (Node, Document, ...)?

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation