java.lang.Object | +--gnu.xml.dom.DomNodeAll Implemented Interfaces:
DomNode(org.w3c.dom.Document owner) Constructs a node and associates it with its owner. |
void | addEventListener(java.lang.String type, EventListener listener, boolean useCapture) DOM L2 (Events) Registers an event listener's interest in a class of events. |
org.w3c.dom.Node | appendChild(org.w3c.dom.Node newChild) DOM L1 Appends the specified node to this node's list of children. |
java.lang.Object | clone() Clones this node; roughly equivalent to cloneNode(false). |
org.w3c.dom.Node | cloneNode(boolean deep) DOM L1 Returns a clone of this node which optionally includes cloned versions of child nodes. |
void | compact() Reduces space utilization for this node. |
org.w3c.dom.events.Event | createEvent(java.lang.String eventType) DOM L2 (Events) Returns an instance of the specified type of event object. |
boolean | dispatchEvent(org.w3c.dom.events.Event event) DOM L2 (Events) Delivers an event to all relevant listeners, returning true if the caller should perform their default action. |
org.w3c.dom.NamedNodeMap | getAttributes() DOM L1 Returns null; Element subclasses must override this method. |
org.w3c.dom.NodeList | getChildNodes() DOM L1 Returns a list, possibly empty, of the children of this node. |
org.w3c.dom.NodeList | getElementsByTagName(java.lang.String tag) DOM L1 Creates a NodeList giving array-style access to elements with the specified name. |
org.w3c.dom.NodeList | getElementsByTagNameNS(java.lang.String namespace, java.lang.String local) DOM L2 Creates a NodeList giving array-style access to elements with the specified namespace and local name. |
org.w3c.dom.Node | getFirstChild() DOM L1 Returns the first child of this node, or null if there are none. |
org.w3c.dom.Node | getLastChild() DOM L1 Returns the last child of this node, or null if there are none. |
int | getLength() DOM L1 (NodeList) Returns the number of elements in this NodeList. |
java.lang.String | getLocalName() DOM L2 Returns the node name; this must be overridden for element and attribute nodes. |
java.lang.String | getNamespaceURI() DOM L2 Returns null; this must be overridden for element and attribute nodes. |
org.w3c.dom.Node | getNextSibling() DOM L1 Returns the previous sibling, if one is known. |
java.lang.String | getNodeName() This forces GCJ compatibility. |
short | getNodeType() This forces GCJ compatibility. |
java.lang.String | getNodeValue() DOM L1 Returns null; this must be overridden for nodes types with a defined value, along with the setNodeValue method. |
org.w3c.dom.Document | getOwnerDocument() DOM L1 (modified in L2) Returns the owner document. |
org.w3c.dom.Node | getParentNode() DOM L1 Returns the parent node, if one is known. |
java.lang.String | getPrefix() DOM L2 Returns null; this must be overridden for element and attribute nodes. |
org.w3c.dom.Node | getPreviousSibling() DOM L1 Returns the previous sibling, if one is known. |
boolean | hasAttributes() DOM L2> Returns true iff this is an element node with attributes. |
boolean | hasChildNodes() DOM L1 Returns true if this node has children. |
org.w3c.dom.Node | insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) DOM L1 Inserts the specified node in this node's list of children. |
boolean | isReadonly() Exposes the internal "readonly" flag. |
boolean | isSupported(java.lang.String feature, java.lang.String version) DOM L2 Consults the DOM implementation to determine if the requested feature is supported. |
org.w3c.dom.Node | item(int index) DOM L1 (NodeList) Returns the item with the specified index in this NodeList, else null. |
void | makeReadonly() Sets the internal "readonly" flag so this subtree can't be changed. |
boolean | nameAndTypeEquals(org.w3c.dom.Node other) Returns true iff node types match, and either (a) both nodes have no namespace and their getNodeName() values are the same, or (b) both nodes have the same getNamespaceURI() and same getLocalName() values. |
void | normalize() DOM L1 (relocated in DOM L2) In this node and all contained nodes (including attributes if relevant) merge adjacent text nodes. |
org.w3c.dom.Node | removeChild(org.w3c.dom.Node refChild) DOM L1 Removes the specified child from this node's list of children, or else reports an exception. |
void | removeEventListener(java.lang.String type, EventListener listener, boolean useCapture) DOM L2 (Events) Unregisters an event listener. |
org.w3c.dom.Node | replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) DOM L1 Replaces the specified node in this node's list of children. |
void | setNodeValue(java.lang.String value) DOM L1 Does nothing; this must be overridden (along with the getNodeValue method) for nodes with a non-null defined value. |
void | setPrefix(java.lang.String prefix) DOM L2 Does nothing; this must be overridden (along with the getPrefix method) for element and attribute nodes. |
void | trimToSize() Minimize extra space consumed by this node to hold children and event listeners. |
protected DomNode(org.w3c.dom.Document owner)
owner
- public final void addEventListener(java.lang.String type, EventListener listener, boolean useCapture)
type
- listener
- useCapture
- public Node appendChild(org.w3c.dom.Node newChild)
Causes a DOMNodeInserted mutation event to be reported. Will first cause a DOMNodeRemoved event to be reported if the parameter already has a parent. If the new child is a document fragment node, both events will be reported for each child of the fragment; the order in which children are removed and inserted is implementation-specific.
If this DOM has been compiled without mutation event support, these events will not be reported.
newChild
- public Object clone()
public Node cloneNode(boolean deep)
deep
- public void compact()
public Event createEvent(java.lang.String eventType)
If the name of the event type begins with "USER-", then an object implementing the "Event" class will be returned; this provides a limited facility for application-defined events to use the DOM event infrastructure. Alternatively, use one of the standard DOM event classes and initialize it using use such a "USER-" event type name; or defin, instantiate, and initialize an application-specific subclass of DomEvent and pass that to dispatchEvent().
eventType
- Identifies the particular DOM feature module
defining the type of event, such as "MutationEvents".public final boolean dispatchEvent(org.w3c.dom.events.Event event)
event
- NullPointerException
- When a null event is passed.ClassCastException
- When the event wasn't provided by
the createEvent method, or otherwise isn't a DomEvent.org.w3c.dom.events.EventException
- If the event type wasn't specifiedpublic NamedNodeMap getAttributes()
public NodeList getChildNodes()
public NodeList getElementsByTagName(java.lang.String tag)
tag
- public NodeList getElementsByTagNameNS(java.lang.String namespace, java.lang.String local)
namespace
- local
- public final Node getFirstChild()
public final Node getLastChild()
public int getLength()
public String getLocalName()
public String getNamespaceURI()
public final Node getNextSibling()
public String getNodeName()
public short getNodeType()
public String getNodeValue()
public final Document getOwnerDocument()
public final Node getParentNode()
public String getPrefix()
public final Node getPreviousSibling()
public boolean hasAttributes()
public final boolean hasChildNodes()
public Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
Causes a DOMNodeInserted mutation event to be reported. Will first cause a DOMNodeRemoved event to be reported if the newChild parameter already has a parent. If the new child is a document fragment node, both events will be reported for each child of the fragment; the order in which children are removed and inserted is implementation-specific.
If this DOM has been compiled without mutation event support, these events will not be reported.
newChild
- refChild
- public final boolean isReadonly()
public boolean isSupported(java.lang.String feature, java.lang.String version)
feature
- version
- public final Node item(int index)
index
- public void makeReadonly()
public boolean nameAndTypeEquals(org.w3c.dom.Node other)
Note that notion of a "Per-Element-Type" attribute name scope, as found in a non-normative appendix of the XML Namespaces specification, is not supported here. Your application must implement that notion, typically by not bothering to check nameAndTypeEquals for attributes without namespace URIs unless you already know their elements are nameAndTypeEquals.
other
- public void normalize()
public Node removeChild(org.w3c.dom.Node refChild)
Causes a DOMNodeRemoved mutation event to be reported.
If this DOM has been compiled without mutation event support, these events will not be reported.
refChild
- public final void removeEventListener(java.lang.String type, EventListener listener, boolean useCapture)
type
- listener
- useCapture
- public Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
Causes DOMNodeRemoved and DOMNodeInserted mutation event to be reported. Will cause another DOMNodeRemoved event to be reported if the newChild parameter already has a parent. These events may be delivered in any order, except that the event reporting removal from such an existing parent will always be delivered before the event reporting its re-insertion as a child of some other node. The order in which children are removed and inserted is implementation specific.
If your application needs to depend on the in which those removal and insertion events are delivered, don't use this API. Instead, invoke the removeChild and insertBefore methods directly, to guarantee a specific delivery order. Similarly, don't use document fragments, Otherwise your application code may not work on a DOM which implements this method differently.
If this DOM has been compiled without mutation event support, these events will not be reported.
newChild
- refChild
- public void setNodeValue(java.lang.String value)
value
- public void setPrefix(java.lang.String prefix)
prefix
- public void trimToSize()
"Node", "EventTarget", and "DocumentEvent" implementation. This provides most of the core DOM functionality; only more specialized features are provided by subclasses. Those subclasses may have some particular constraints they must implement, by overriding methods defined here. Such constraints are noted here in the method documentation.
Note that you can create events with type names prefixed with "USER-", and pass them through this DOM. This lets you use the DOM event scheme for application specific purposes, although you must use a predefined event structure (such as MutationEvent) to pass data along with those events. Test for existence of this feature with the "USER-Events" DOM feature name.
Other kinds of events you can send include the "html" events, like "load", "unload", "abort", "error", and "blur"; and the mutation events. If this DOM has been compiled with mutation event support enabled, it will send mutation events when you change parts of the tree; otherwise you may create and send such events yourself, but they won't be generated by the DOM itself.
Note that there is a namespace-aware name comparison method, nameAndTypeEquals, which compares the names (and types) of two nodes in conformance with the "Namespaces in XML" specification. While mostly intended for use with elements and attributes, this should also be helpful for ProcessingInstruction nodes and some others which do not have namespace URIs.