Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.xml.dtm.ref.DTMNodeProxy
public class DTMNodeProxy
extends java.lang.Object
implements Node, Document, Text, Element, Attr, ProcessingInstruction, Comment, DocumentFragment
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.
org.w3c.dom
Nested Class Summary |
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 | |
|
Method Summary | |
Node | |
Node |
|
void |
|
Node |
|
Attr |
|
Attr |
|
CDATASection |
|
Comment |
|
DocumentFragment | |
Element |
|
Element |
|
EntityReference |
|
ProcessingInstruction |
|
Text |
|
void |
|
boolean |
|
boolean | |
String |
|
String |
|
Attr |
|
Attr |
|
NamedNodeMap | |
NodeList | |
DTM |
|
int |
|
String |
|
DocumentType | |
Element |
|
Element |
|
NodeList |
|
NodeList |
|
String |
|
Node | |
DOMImplementation | |
Node | |
int | |
String | |
String |
|
String | |
Node | |
String | |
short | |
String | |
Document | |
Element |
|
Node | |
Node | |
String | |
Node | |
boolean | |
boolean |
|
boolean |
|
String | |
String | |
String |
|
String |
|
String |
|
boolean |
|
boolean |
|
boolean |
|
boolean | |
Node |
|
Node |
|
void |
|
boolean |
|
void | |
void |
|
void |
|
Attr |
|
Node |
|
Node |
|
void |
|
boolean |
|
void |
|
void |
|
Attr |
|
Attr |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Text |
|
String |
|
boolean |
|
public DTMNodeProxy(DTM dtm, int node)
Create a DTMNodeProxy Node representing a specific Node in a DTM
- Parameters:
dtm
- The DTM Reference, must be non-null.node
- The DTM node handle.
public Node adoptNode(Node source) throws DOMException
NEEDSDOC Method adoptNode NEEDSDOC @param source
- Throws:
DOMException
-
public final Node appendChild(Node newChild) throws DOMException
- Specified by:
- appendChild in interface Node
- Parameters:
newChild
-
- Throws:
DOMException
-
- See Also:
-- DTMNodeProxy is read-only
public final void appendData(String arg) throws DOMException
- Specified by:
- appendData in interface CharacterData
- Parameters:
arg
-
- Throws:
DOMException
-
- See Also:
CharacterData
public final Node cloneNode(boolean deep)
- Parameters:
deep
-
- See Also:
-- DTMNodeProxy is read-only
public final Attr createAttribute(String name) throws DOMException
- Specified by:
- createAttribute in interface Document
- Parameters:
name
-
- Throws:
DOMException
-
- See Also:
Document
public final Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
- createAttributeNS in interface Document
- Parameters:
namespaceURI
-qualifiedName
-
- Throws:
DOMException
-
- See Also:
as of DOM Level 2
public final CDATASection createCDATASection(String data) throws DOMException
- Specified by:
- createCDATASection in interface Document
- Parameters:
data
-
- Throws:
DOMException
-
- See Also:
Document
public final Comment createComment(String data)
- Specified by:
- createComment in interface Document
- Parameters:
data
-
- See Also:
Document
public final DocumentFragment createDocumentFragment()
- Specified by:
- createDocumentFragment in interface Document
- See Also:
Document
public final Element createElement(String tagName) throws DOMException
- Specified by:
- createElement in interface Document
- Parameters:
tagName
-
- Throws:
DOMException
-
- See Also:
Document
public final Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
- createElementNS in interface Document
- Parameters:
namespaceURI
-qualifiedName
-
- Throws:
DOMException
-
- See Also:
as of DOM Level 2
public final EntityReference createEntityReference(String name) throws DOMException
- Specified by:
- createEntityReference in interface Document
- Parameters:
name
-
- Throws:
DOMException
-
- See Also:
Document
public final ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
- Specified by:
- createProcessingInstruction in interface Document
- Parameters:
target
-data
-
- Throws:
DOMException
-
- See Also:
Document
public final Text createTextNode(String data)
- Specified by:
- createTextNode in interface Document
- Parameters:
data
-
- See Also:
Document
public final void deleteData(int offset, int count) throws DOMException
- Specified by:
- deleteData in interface CharacterData
- Parameters:
offset
-count
-
- Throws:
DOMException
-
- See Also:
CharacterData
public final boolean equals(Object node)
Test for equality based on node number.
- Parameters:
node
- A DTM node proxy reference.
- Returns:
- true if the given node has the same handle as this node.
public final boolean equals(Node node)
Test for equality based on node number.
- Parameters:
node
- A DTM node proxy reference.
- Returns:
- true if the given node has the same handle as this node.
public final String getAttribute(String name)
- Specified by:
- getAttribute in interface Element
- Parameters:
name
-
- See Also:
Element
public final String getAttributeNS(String namespaceURI, String localName)
- Specified by:
- getAttributeNS in interface Element
- Parameters:
namespaceURI
-localName
-
- See Also:
Element
public final Attr getAttributeNode(String name)
- Specified by:
- getAttributeNode in interface Element
- Parameters:
name
-
- See Also:
Element
public final Attr getAttributeNodeNS(String namespaceURI, String localName)
- Specified by:
- getAttributeNodeNS in interface Element
- Parameters:
namespaceURI
-localName
-
- See Also:
Element
public final NamedNodeMap getAttributes()
- Specified by:
- getAttributes in interface Node
- See Also:
Node
public final NodeList getChildNodes()
- Specified by:
- getChildNodes in interface Node
- See Also:
Node
public final DTM getDTM()
NON-DOM: Return the DTM model
- Returns:
- The DTM that this proxy is a representative for.
public final int getDTMNodeNumber()
NON-DOM: Return the DTM node number
- Returns:
- The DTM node handle.
public final String getData() throws DOMException
- Specified by:
- getData in interface CharacterData
- getData in interface ProcessingInstruction
- Throws:
DOMException
-
- See Also:
CharacterData
public final DocumentType getDoctype()
- Specified by:
- getDoctype in interface Document
- See Also:
Document
public final Element 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. We can make it work in the well-formed cases but would that be confusing for others?
- Specified by:
- getDocumentElement in interface Document
- See Also:
Document
public final Element getElementById(String elementId)
- Specified by:
- getElementById in interface Document
- Parameters:
elementId
-
- See Also:
as of DOM Level 2
public final NodeList getElementsByTagName(String tagname)
- Specified by:
- getElementsByTagName in interface Document
- getElementsByTagName in interface Element
- Parameters:
tagname
-
- See Also:
Document
public final NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- Specified by:
- getElementsByTagNameNS in interface Document
- getElementsByTagNameNS in interface Element
- Parameters:
namespaceURI
-localName
-
- See Also:
as of DOM Level 2
public String getEncoding()
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying, as part of the XML declaration, the encoding of this document. This isnull
when unspecified.
- Since:
- DOM Level 3
public final Node getFirstChild()
- Specified by:
- getFirstChild in interface Node
- See Also:
Node
public final DOMImplementation getImplementation()
- Specified by:
- getImplementation in interface Document
- See Also:
Document
public final Node getLastChild()
- Specified by:
- getLastChild in interface Node
- See Also:
Node
public final int getLength()
- Specified by:
- getLength in interface CharacterData
- See Also:
CharacterData
public final String getLocalName()
- Specified by:
- getLocalName in interface Node
- See Also:
as of DOM Level 2
public final String getNamespaceURI()
- Specified by:
- getNamespaceURI in interface Node
- See Also:
as of DOM Level 2
public final Node getNextSibling()
- Specified by:
- getNextSibling in interface Node
- See Also:
Node
public final String getNodeValue() throws DOMException
- Specified by:
- getNodeValue in interface Node
- Throws:
DOMException
-
- See Also:
Node
public final Document getOwnerDocument()
- Specified by:
- getOwnerDocument in interface Node
- See Also:
Node
public final Element getOwnerElement()
Get the owner element of an attribute.
- Specified by:
- getOwnerElement in interface Attr
- See Also:
as of DOM Level 2
public final Node getParentNode()
- Specified by:
- getParentNode in interface Node
- See Also:
Node
public final Node getPreviousSibling()
- Specified by:
- getPreviousSibling in interface Node
- See Also:
Node
public final boolean getSpecified()
- Specified by:
- getSpecified in interface Attr
- See Also:
Attr
public boolean getStandalone()
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying, as part of the XML declaration, whether this document is standalone.
- Since:
- DOM Level 3
public boolean getStrictErrorChecking()
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying whether errors checking is enforced or not. When set tofalse
, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise anyDOMException
. In case of error, the behavior is undefined. This attribute istrue
by defaults.
- Since:
- DOM Level 3
public final String getStringValue() throws DOMException
- Returns:
- The string value of the node
- Throws:
DOMException
-
public final String getTagName()
- Specified by:
- getTagName in interface Element
- See Also:
Element
public final String getTarget()
A PI's "target" states what processor channel the PI's data should be directed to. It is defined differently in HTML and XML. In XML, a PI's "target" is the first (whitespace-delimited) token following the "<?" token that begins the PI. In HTML, target is always null. Note that getNodeName is aliased to getTarget.
- Specified by:
- getTarget in interface ProcessingInstruction
public String getVersion()
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying, as part of the XML declaration, the version number of this document. This isnull
when unspecified.
- Since:
- DOM Level 3
public boolean hasAttribute(String name)
Method hasAttribute
- Specified by:
- hasAttribute in interface Element
- Parameters:
name
-
public boolean hasAttributeNS(String name, String x)
Method hasAttributeNS
- Specified by:
- hasAttributeNS in interface Element
- Parameters:
name
-x
-
public boolean hasAttributes()
Introduced in DOM Level 2.
- Specified by:
- hasAttributes in interface Node
public final boolean hasChildNodes()
- Specified by:
- hasChildNodes in interface Node
- See Also:
Node
public final Node importNode(Node importedNode, boolean deep) throws DOMException
- Specified by:
- importNode in interface Document
- Parameters:
importedNode
-deep
-
- Throws:
DOMException
-
public final Node insertBefore(Node newChild, Node refChild) throws DOMException
- Specified by:
- insertBefore in interface Node
- Parameters:
newChild
-refChild
-
- Throws:
DOMException
-
- See Also:
-- DTMNodeProxy is read-only
public final void insertData(int offset, String arg) throws DOMException
- Specified by:
- insertData in interface CharacterData
- Parameters:
offset
-arg
-
- Throws:
DOMException
-
- See Also:
CharacterData
public final boolean isSupported(String feature, String version)
Ask whether we support a given DOM feature. In fact, we do not _fully_ support any DOM feature -- we're a read-only subset -- so arguably we should always return false.
- Specified by:
- isSupported in interface Node
- Parameters:
feature
-version
-
- Returns:
- false
- See Also:
as of DOM Level 2
public final void removeAttribute(String name) throws DOMException
- Specified by:
- removeAttribute in interface Element
- Parameters:
name
-
- Throws:
DOMException
-
- See Also:
Element
public final void removeAttributeNS(String namespaceURI, String localName) throws DOMException
- Specified by:
- removeAttributeNS in interface Element
- Parameters:
namespaceURI
-localName
-
- Throws:
DOMException
-
- See Also:
Element
public final Attr removeAttributeNode(Attr oldAttr) throws DOMException
- Specified by:
- removeAttributeNode in interface Element
- Parameters:
oldAttr
-
- Throws:
DOMException
-
- See Also:
Element
public final Node removeChild(Node oldChild) throws DOMException
- Specified by:
- removeChild in interface Node
- Parameters:
oldChild
-
- Throws:
DOMException
-
- See Also:
-- DTMNodeProxy is read-only
public final Node replaceChild(Node newChild, Node oldChild) throws DOMException
- Specified by:
- replaceChild in interface Node
- Parameters:
newChild
-oldChild
-
- Throws:
DOMException
-
- See Also:
-- DTMNodeProxy is read-only
public final void replaceData(int offset, int count, String arg) throws DOMException
- Specified by:
- replaceData in interface CharacterData
- Parameters:
offset
-count
-arg
-
- Throws:
DOMException
-
- See Also:
CharacterData
public final boolean sameNodeAs(Node other)
FUTURE DOM: Test node identity, in lieu of Node==Node
- Parameters:
other
-
- Returns:
- true if the given node has the same handle as this node.
public final void setAttribute(String name, String value) throws DOMException
- Specified by:
- setAttribute in interface Element
- Parameters:
name
-value
-
- Throws:
DOMException
-
- See Also:
Element
public final void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException
- Specified by:
- setAttributeNS in interface Element
- Parameters:
namespaceURI
-qualifiedName
-value
-
- Throws:
DOMException
-
- See Also:
Element
public final Attr setAttributeNode(Attr newAttr) throws DOMException
- Specified by:
- setAttributeNode in interface Element
- Parameters:
newAttr
-
- Throws:
DOMException
-
- See Also:
Element
public final Attr setAttributeNodeNS(Attr newAttr) throws DOMException
- Specified by:
- setAttributeNodeNS in interface Element
- Parameters:
newAttr
-
- Throws:
DOMException
-
- See Also:
Element
public final void setData(String data) throws DOMException
- Specified by:
- setData in interface CharacterData
- setData in interface ProcessingInstruction
- Parameters:
data
-
- Throws:
DOMException
-
- See Also:
CharacterData
public void setEncoding(String encoding)
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying, as part of the XML declaration, the encoding of this document. This isnull
when unspecified.
- Since:
- DOM Level 3 NEEDSDOC @param encoding
public final void setNodeValue(String nodeValue) throws DOMException
- Specified by:
- setNodeValue in interface Node
- Parameters:
nodeValue
-
- Throws:
DOMException
-
- See Also:
-- DTMNodeProxy is read-only
public final void setPrefix(String prefix) throws DOMException
- Parameters:
prefix
-
- Throws:
DOMException
-
public void setStandalone(boolean standalone)
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying, as part of the XML declaration, whether this document is standalone.
- Since:
- DOM Level 3 NEEDSDOC @param standalone
public void setStrictErrorChecking(boolean strictErrorChecking)
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying whether errors checking is enforced or not. When set tofalse
, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise anyDOMException
. In case of error, the behavior is undefined. This attribute istrue
by defaults.
- Since:
- DOM Level 3 NEEDSDOC @param strictErrorChecking
public void setVersion(String version)
EXPERIMENTAL! Based on the Document Object Model (DOM) Level 3 Core Working Draft of 5 June 2001.. An attribute specifying, as part of the XML declaration, the version number of this document. This isnull
when unspecified.
- Since:
- DOM Level 3 NEEDSDOC @param version
public final Text splitText(int offset) throws DOMException
- Parameters:
offset
-
- Throws:
DOMException
-
- See Also:
Text
public final String substringData(int offset, int count) throws DOMException
- Specified by:
- substringData in interface CharacterData
- Parameters:
offset
-count
-
- Throws:
DOMException
-
- See Also:
CharacterData
public final boolean supports(String feature, String version)
Ask whether we support a given DOM feature. In fact, we do not _fully_ support any DOM feature -- we're a read-only subset -- so arguably we should always return false. Or we could say that we support DOM Core Level 2 but all nodes are read-only. Unclear which answer is least misleading. NON-DOM method. This was present in early drafts of DOM Level 2, but was renamed isSupported. It's present here only because it's cheap, harmless, and might help some poor fool who is still trying to use an early Working Draft of the DOM.
- Parameters:
feature
-version
-
- Returns:
- false