Top Description Inners Fields Constructors Methods
com.sun.org.apache.xml.internal.dtm.ref

public Class DTMNodeProxy

extends Object
implements Node, Document, Text, Element, Attr, ProcessingInstruction, Comment, DocumentFragment
Class Inheritance
All Implemented Interfaces
org.w3c.dom.DocumentFragment, org.w3c.dom.Node, org.w3c.dom.Comment, org.w3c.dom.CharacterData, org.w3c.dom.ProcessingInstruction, org.w3c.dom.Attr, org.w3c.dom.Element, org.w3c.dom.Text, org.w3c.dom.Document
Imports
com.sun.org.apache.xml.internal.dtm.DTM, .DTMDOMException, com.sun.org.apache.xpath.internal.NodeSet, java.util.ArrayList, .List, .Objects, org.w3c.dom.Attr, .CDATASection, .Comment, .DOMConfiguration, .DOMException, .DOMImplementation, .Document, .DocumentFragment, .DocumentType, .Element, .EntityReference, .NamedNodeMap, .Node, .NodeList, .ProcessingInstruction, .Text, .TypeInfo, .UserDataHandler

DTMNodeProxy presents a DOM Node API front-end to the DTM model.

It does _not_ attempt to address the "node identity" question; no effort is made to prevent the creation of multiple proxies referring to a single DTM node. Users can create a mechanism for managing this, or relinquish the use of "==" and use the .sameNodeAs() mechanism, which is under consideration for future versions of the DOM.

DTMNodeProxy may be subclassed further to present specific DOM node types.

See Also
org.w3c.dom

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
DTMNodeProxy.DTMNodeProxyImplementation

Inner class to support getDOMImplementation.

Field Summary

Modifier and TypeField and Description
protected String
actualEncoding

DOM Level 3 feature: Document actualEncoding

public DTM
dtm

The DTM for this node.

private static final String
EMPTYSTRING

The return value as Empty String.

protected String
fDocumentURI

DOM Level 3 feature: documentURI

pack-priv static final DOMImplementation
implementation

The DOMImplementation object

pack-priv int
node

The DTM node handle.

private String
private boolean
private String

Constructor Summary

AccessConstructor and Description
public
DTMNodeProxy(DTM
The DTM Reference, must be non-null.
dtm
,
int
The DTM node handle.
node
)

Create a DTMNodeProxy Node representing a specific Node in a DTM

Method Summary

Modifier and TypeMethod and Description
public Node
adoptNode(Node
The node to move into this document.
source
)

Implements org.w3c.dom.Document.adoptNode.

NEEDSDOC Method adoptNode NEEDSDOC @param source NEEDSDOC (adoptNode) @return

public final Node
appendChild(Node newChild)

Implements org.w3c.dom.Node.appendChild.

Adds the node newChild to the end of the list of children of this node.

public final void
appendData(String arg)

Implements org.w3c.dom.CharacterData.appendData.

Append the string to the end of the character data of the node.

public final Node
cloneNode(boolean deep)

Implements org.w3c.dom.Node.cloneNode.

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.

public short

Returns:

Returns how the given node is positioned relatively to this node.
compareDocumentPosition
(Node
The node to compare against this node.
other
)

Implements org.w3c.dom.Node.compareDocumentPosition.

Compares a node with this node with regard to their position in the document.

public final Attr
createAttribute(String name)

Implements org.w3c.dom.Document.createAttribute.

Creates an Attr of the given name.

public final Attr
createAttributeNS(String namespaceURI, String qualifiedName)

Implements org.w3c.dom.Document.createAttributeNS.

Creates an attribute of the given qualified name and namespace URI.

public final CDATASection
createCDATASection(String data)

Implements org.w3c.dom.Document.createCDATASection.

Creates a CDATASection node whose value is the specified string.

public final Comment
createComment(String data)

Implements org.w3c.dom.Document.createComment.

Creates a Comment node given the specified string.

public final DocumentFragment
createDocumentFragment()

Implements org.w3c.dom.Document.createDocumentFragment.

Creates an empty DocumentFragment object.

public final Element
createElement(String tagName)

Implements org.w3c.dom.Document.createElement.

Creates an element of the type specified.

public final Element
createElementNS(String namespaceURI, String qualifiedName)

Implements org.w3c.dom.Document.createElementNS.

Creates an element of the given qualified name and namespace URI.

public final EntityReference
createEntityReference(String name)

Implements org.w3c.dom.Document.createEntityReference.

Creates an EntityReference object.

public final ProcessingInstruction
createProcessingInstruction(String target, String data)

Implements org.w3c.dom.Document.createProcessingInstruction.

Creates a ProcessingInstruction node given the specified name and data strings.

public final Text
createTextNode(String data)

Implements org.w3c.dom.Document.createTextNode.

Creates a Text node given the specified string.

public final void
deleteData(int offset, int count)

Implements org.w3c.dom.CharacterData.deleteData.

Remove a range of 16-bit units from the node.

public final boolean

Returns:

true if the given node has the same handle as this node.
equals
(Node
A DTM node proxy reference.
node
)

Test for equality based on node number.

public final boolean

Returns:

true if the given node has the same handle as this node.
equals
(Object
A DTM node proxy reference.
node
)

Overrides java.lang.Object.equals.

Test for equality based on node number.

public String
getActualEncoding()

DOM Level 3 An attribute specifying the actual encoding of this document.

public final String
getAttribute(String name)

Implements org.w3c.dom.Element.getAttribute.

Retrieves an attribute value by name.

public final Attr
getAttributeNode(String name)

Implements org.w3c.dom.Element.getAttributeNode.

Retrieves an attribute node by name.

public final Attr
getAttributeNodeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.getAttributeNodeNS.

Retrieves an Attr node by local name and namespace URI.

public final String
getAttributeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.getAttributeNS.

Retrieves an attribute value by local name and namespace URI.

public final NamedNodeMap
getAttributes()

Implements org.w3c.dom.Node.getAttributes.

A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

public String
getBaseURI()

Implements org.w3c.dom.Node.getBaseURI.

The absolute base URI of this node or null if undefined.

public final NodeList
getChildNodes()

Implements org.w3c.dom.Node.getChildNodes.

A NodeList that contains all children of this node.

public final String
getData()

Implements org.w3c.dom.CharacterData.getData, org.w3c.dom.ProcessingInstruction.getData.

The content of this processing instruction.

public final DocumentType
getDoctype()

Implements org.w3c.dom.Document.getDoctype.

The Document Type Declaration (see DocumentType) associated with this document.

public final Element
getDocumentElement()

Implements org.w3c.dom.Document.getDocumentElement.

This is a bit of a problem in DTM, since a DTM may be a Document Fragment and hence not have a clear-cut Document Element.

public String
getDocumentURI()

Implements org.w3c.dom.Document.getDocumentURI.

DOM Level 3 The location of the document or null if undefined.

public DOMConfiguration
getDomConfig()

Implements org.w3c.dom.Document.getDomConfig.

The configuration used when Document.normalizeDocument is invoked.

public final DTM

Returns:

The DTM that this proxy is a representative for.
getDTM
()

NON-DOM: Return the DTM model

public final int

Returns:

The DTM node handle.
getDTMNodeNumber
()

NON-DOM: Return the DTM node number

public final Element
getElementById(String elementId)

Implements org.w3c.dom.Document.getElementById.

Returns the Element that has an ID attribute with the given value.

public final NodeList
getElementsByTagName(String tagname)

Implements org.w3c.dom.Document.getElementsByTagName, org.w3c.dom.Element.getElementsByTagName.

Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.

public final NodeList
getElementsByTagNameNS(String namespaceURI, String localName)

Implements org.w3c.dom.Document.getElementsByTagNameNS, org.w3c.dom.Element.getElementsByTagNameNS.

Returns a NodeList of all the Elements with a given local name and namespace URI in document order.

public Object

Returns:

Returns an object which implements the specialized APIs of the specified feature and version, if any, or null if there is no object which implements interfaces associated with that feature. If the DOMObject returned by this method implements the Node interface, it must delegate to the primary core Node and not return results inconsistent with the primary core Node such as attributes, childNodes, etc.
getFeature
(String
The name of the feature requested (case-insensitive).
feature
,
String
This is the version number of the feature to test. If the version is null or the empty string, supporting any version of the feature will cause the method to return an object that supports at least one version of the feature.
version
)

Implements org.w3c.dom.Node.getFeature.

This method returns a specialized object which implements the specialized APIs of the specified feature and version.

public final Node
getFirstChild()

Implements org.w3c.dom.Node.getFirstChild.

The first child of this node.

public final DOMImplementation
getImplementation()

Implements org.w3c.dom.Document.getImplementation.

The DOMImplementation object that handles this document.

public String
public final Node
getLastChild()

Implements org.w3c.dom.Node.getLastChild.

The last child of this node.

public final int
getLength()

Implements org.w3c.dom.CharacterData.getLength.

The number of 16-bit units that are available through data and the substringData method below.

public final String
getLocalName()

Implements org.w3c.dom.Node.getLocalName.

Returns the local part of the qualified name of this node.

public final String
getName()

Implements org.w3c.dom.Attr.getName.

Returns the name of this attribute.

public final String
getNamespaceURI()

Implements org.w3c.dom.Node.getNamespaceURI.

The namespace URI of this node, or null if it is unspecified (see ).

public final Node
getNextSibling()

Implements org.w3c.dom.Node.getNextSibling.

The node immediately following this node.

public final String
getNodeName()

Implements org.w3c.dom.Node.getNodeName.

The name of this node, depending on its type; see the table above.

public final short
getNodeType()

Implements org.w3c.dom.Node.getNodeType.

A code representing the type of the underlying object, as defined above.

public final String
getNodeValue()

Implements org.w3c.dom.Node.getNodeValue.

The value of this node, depending on its type; see the table above.

public final Document
getOwnerDocument()

Implements org.w3c.dom.Node.getOwnerDocument.

The Document object associated with this node.

public final Element
getOwnerElement()

Implements org.w3c.dom.Attr.getOwnerElement.

Get the owner element of an attribute.

public final Node
public final Node
getParentNode()

Implements org.w3c.dom.Node.getParentNode.

The parent of this node.

public final String

Returns:

The prefix for this node.
getPrefix
()

Implements org.w3c.dom.Node.getPrefix.

The namespace prefix of this node, or null if it is unspecified.

public final Node
getPreviousSibling()

Implements org.w3c.dom.Node.getPreviousSibling.

The node immediately preceding this node.

public TypeInfo

Returns:

TypeInfo
getSchemaTypeInfo
()

Implements org.w3c.dom.Element.getSchemaTypeInfo, org.w3c.dom.Attr.getSchemaTypeInfo.

Method getSchemaTypeInfo.

public final boolean
getSpecified()

Implements org.w3c.dom.Attr.getSpecified.

True if this attribute was explicitly given a value in the instance document, false otherwise.

public boolean
getStandalone()

EXPERIMENTAL!

public boolean
public final String

Returns:

The string value of the node
getStringValue
()

public final String
getTagName()

Implements org.w3c.dom.Element.getTagName.

The name of the element.

public final String
getTarget()

Implements org.w3c.dom.ProcessingInstruction.getTarget.

A PI's "target" states what processor channel the PI's data should be directed to.

public String
getTextContent()

Implements org.w3c.dom.Node.getTextContent.

This attribute returns the text content of this node and its descendants.

public Object

Returns:

Returns the DOMObject associated to the given key on this node, or null if there was none.
getUserData
(String
The key the object is associated to.
key
)

Implements org.w3c.dom.Node.getUserData.

Retrieves the object associated to a key on a this node.

public final String
getValue()

Implements org.w3c.dom.Attr.getValue.

On retrieval, the value of the attribute is returned as a string.

public String
getVersion()

EXPERIMENTAL!

public String
getWholeText()

Implements org.w3c.dom.Text.getWholeText.

DOM Level 3 Returns all text of Text nodes logically-adjacent text nodes to this node, concatenated in document order.

public String
getXmlEncoding()

Implements org.w3c.dom.Document.getXmlEncoding.

An attribute specifying, as part of the XML declaration, the encoding of this document.

public boolean
getXmlStandalone()

Implements org.w3c.dom.Document.getXmlStandalone.

An attribute specifying, as part of the XML declaration, whether this document is standalone.

public String
getXmlVersion()

Implements org.w3c.dom.Document.getXmlVersion.

An attribute specifying, as part of the XML declaration, the version number of this document.

public boolean
hasAttribute(String name)

Implements org.w3c.dom.Element.hasAttribute.

Method hasAttribute

public boolean
hasAttributeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.hasAttributeNS.

Method hasAttributeNS

public boolean
hasAttributes()

Implements org.w3c.dom.Node.hasAttributes.

Introduced in DOM Level 2.

public final boolean
hasChildNodes()

Implements org.w3c.dom.Node.hasChildNodes.

Returns whether this node has any children.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public final Node
importNode(Node importedNode, boolean deep)

Implements org.w3c.dom.Document.importNode.

Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node.

public final Node
insertBefore(Node newChild, Node refChild)

Implements org.w3c.dom.Node.insertBefore.

Inserts the node newChild before the existing child node refChild.

public final void
insertData(int offset, String arg)

Implements org.w3c.dom.CharacterData.insertData.

Insert a string at the specified 16-bit unit offset.

public boolean

Returns:

true if the specified namespaceURI is the default namespace, false otherwise.
isDefaultNamespace
(String
The namespace URI to look for.
namespaceURI
)

Implements org.w3c.dom.Node.isDefaultNamespace.

DOM Level 3 This method checks if the specified namespaceURI is the default namespace or not.

public boolean
isElementContentWhitespace()

Implements org.w3c.dom.Text.isElementContentWhitespace.

DOM Level 3 Returns whether this text node contains whitespace in element content, often abusively called "ignorable whitespace".

public boolean

Returns:

If the nodes, and possibly subtrees are equal, true otherwise false.
isEqualNode
(Node
The node to compare equality with.
arg
)

Implements org.w3c.dom.Node.isEqualNode.

Tests whether two nodes are equal.

public boolean
isId()

Implements org.w3c.dom.Attr.isId.

Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.

public boolean

Returns:

Returns true if the nodes are the same, false otherwise.
isSameNode
(Node
The node to test against.
other
)

Implements org.w3c.dom.Node.isSameNode.

Returns whether this node is the same node as the given one.

public final boolean

Returns:

false
isSupported
(String feature, String version)

Implements org.w3c.dom.Node.isSupported.

Ask whether we support a given DOM feature.

public String

Returns:

th URI for the namespace
lookupNamespaceURI
(String
The prefix to look for. If this parameter is null, the method will return the default namespace URI if any.
specifiedPrefix
)

Implements org.w3c.dom.Node.lookupNamespaceURI.

DOM Level 3 Look up the namespace URI associated to the given prefix, starting from this node.

public String

Returns:

the prefix for the namespace
lookupPrefix
(String namespaceURI)

Implements org.w3c.dom.Node.lookupPrefix.

DOM Level 3 Look up the prefix associated to the given namespace URI, starting from this node.

public final void
normalize()

Implements org.w3c.dom.Node.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.

public void
normalizeDocument()

Implements org.w3c.dom.Document.normalizeDocument.

DOM Level 3 Normalize document.

public final void
removeAttribute(String name)

Implements org.w3c.dom.Element.removeAttribute.

Removes an attribute by name.

public final Attr
removeAttributeNode(Attr oldAttr)

Implements org.w3c.dom.Element.removeAttributeNode.

Removes the specified attribute node.

public final void
removeAttributeNS(String namespaceURI, String localName)

Implements org.w3c.dom.Element.removeAttributeNS.

Removes an attribute by local name and namespace URI.

public final Node
removeChild(Node oldChild)

Implements org.w3c.dom.Node.removeChild.

Removes the child node indicated by oldChild from the list of children, and returns it.

public Node
renameNode(Node
The node to rename.
n
,
String
The new namespace URI.
namespaceURI
,
String
The new qualified name.
name
)

Implements org.w3c.dom.Document.renameNode.

DOM Level 3 Renaming node

public final Node
replaceChild(Node newChild, Node oldChild)

Implements org.w3c.dom.Node.replaceChild.

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

public final void
replaceData(int offset, int count, String arg)

Implements org.w3c.dom.CharacterData.replaceData.

Replace the characters starting at the specified 16-bit unit offset with the specified string.

public Text
replaceWholeText(String
The content of the replacing Text node.
content
)

Implements org.w3c.dom.Text.replaceWholeText.

DOM Level 3

public final boolean

Returns:

true if the given node has the same handle as this node.
sameNodeAs
(Node other)

FUTURE DOM: Test node identity, in lieu of Node==Node

public void
setActualEncoding(String value)

DOM Level 3 An attribute specifying the actual encoding of this document.

public final void
setAttribute(String name, String value)

Implements org.w3c.dom.Element.setAttribute.

Adds a new attribute.

public final Attr
setAttributeNode(Attr newAttr)

Implements org.w3c.dom.Element.setAttributeNode.

Adds a new attribute node.

public final Attr
setAttributeNodeNS(Attr newAttr)

Implements org.w3c.dom.Element.setAttributeNodeNS.

Adds a new attribute.

public final void
setAttributeNS(String namespaceURI, String qualifiedName, String value)

Implements org.w3c.dom.Element.setAttributeNS.

Adds a new attribute.

public final void
setData(String data)

Implements org.w3c.dom.CharacterData.setData, org.w3c.dom.ProcessingInstruction.setData.

The content of this processing instruction.

public void
setDocumentURI(String documentURI)

Implements org.w3c.dom.Document.setDocumentURI.

DOM Level 3

public void
setEncoding(String encoding)

EXPERIMENTAL!

public void
setIdAttribute(boolean id)

NON-DOM: set the type of this attribute to be ID type.

public void
setIdAttribute(String
The name of the attribute.
name
,
boolean
Whether the attribute is a of type ID.
makeId
)

Implements org.w3c.dom.Element.setIdAttribute.

DOM Level 3: register the given attribute node as an ID attribute

public void
setIdAttributeNode(Attr
The attribute node.
at
,
boolean
Whether the attribute is a of type ID.
makeId
)

Implements org.w3c.dom.Element.setIdAttributeNode.

DOM Level 3: register the given attribute node as an ID attribute

public void
setIdAttributeNS(String
The namespace URI of the attribute.
namespaceURI
,
String
The local name of the attribute.
localName
,
boolean
Whether the attribute is a of type ID.
makeId
)

Implements org.w3c.dom.Element.setIdAttributeNS.

DOM Level 3: register the given attribute node as an ID attribute

public final void
setNodeValue(String nodeValue)

Implements org.w3c.dom.Node.setNodeValue.

The value of this node, depending on its type; see the table above.

public final void
setPrefix(String prefix)

Implements org.w3c.dom.Node.setPrefix.

The namespace prefix of this node, or null if it is unspecified.

public void
setStandalone(boolean standalone)

EXPERIMENTAL!

public void
setStrictErrorChecking(boolean strictErrorChecking)

Implements org.w3c.dom.Document.setStrictErrorChecking.

EXPERIMENTAL!

public void
setTextContent(String textContent)

Implements org.w3c.dom.Node.setTextContent.

This attribute returns the text content of this node and its descendants.

public Object
setUserData(String
The key to associate the object to.
key
,
Object
The object to associate to the given key, or null to remove any existing association to that key.
data
,
UserDataHandler
The handler to associate to that key, or null.
handler
)

Implements org.w3c.dom.Node.setUserData.

Associate an object to a key on this node.

public final void
setValue(String value)

Implements org.w3c.dom.Attr.setValue.

On retrieval, the value of the attribute is returned as a string.

public void
setVersion(String version)

EXPERIMENTAL!

public void
setXmlEncoding(String xmlEncoding)

public void
setXmlStandalone(boolean xmlStandalone)

Implements org.w3c.dom.Document.setXmlStandalone.

An attribute specifying, as part of the XML declaration, whether this document is standalone.

public void
setXmlVersion(String xmlVersion)

Implements org.w3c.dom.Document.setXmlVersion.

An attribute specifying, as part of the XML declaration, the version number of this document.

public final Text
splitText(int offset)

Implements org.w3c.dom.Text.splitText.

Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.

public final String
substringData(int offset, int count)

Implements org.w3c.dom.CharacterData.substringData.

Extracts a range of data from the node.

public final boolean

Returns:

false
supports
(String feature, String version)

Ask whether we support a given DOM feature.

private final void
traverseChildren(List<Node> listVector, Node tempNode, String tagname, boolean
Private method to be used for recursive iterations to obtain elements by tag name.
isTagNameWildCard
)

private final void
traverseChildren(List<Node> listVector, Node tempNode, String namespaceURI, String localname, boolean isNamespaceURIWildCard, boolean
Private method to be used for recursive iterations to obtain elements by tag name and namespaceURI.
isLocalNameWildCard
)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait