|
Xerces 3.1.1 API: Class NodeImpl
org.apache.xerces.dom
|
Field Summary | |
static short |
ELEMENT_DEFINITION_NODE
Element definition node type. |
protected static short |
FIRSTCHILD
|
protected short |
flags
|
protected static short |
IGNORABLEWS
|
protected static int |
MUTATION_AGGREGATE
|
protected static int |
MUTATION_ALL
|
protected static int |
MUTATION_LOCAL
|
protected static int |
MUTATION_NONE
The MUTATION_ values are parameters to the NON-DOM internalInsertBefore() and internalRemoveChild() operations, allowing us to control which MutationEvents are generated. |
protected static boolean |
MUTATIONEVENTS
Compile-time flag. |
protected static short |
OWNED
|
protected NodeImpl |
ownerNode
|
protected static short |
READONLY
|
protected static short |
SETVALUE
|
protected static short |
SPECIFIED
|
protected static short |
SYNCCHILDREN
|
protected static short |
SYNCDATA
|
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()
Constructor for serialization. |
protected |
NodeImpl(DocumentImpl ownerDocument)
No public constructor; only subclasses of Node should be instantiated, and those normally via a Document's factory methods |
Method Summary | |
void |
addEventListener(java.lang.String type,
EventListener listener,
boolean useCapture)
Introduced in DOM Level 2. |
Node |
appendChild(Node newChild)
Adds a child node to the end of the list of children for this node. |
protected void |
changed()
Denotes that this node has changed. |
protected int |
changes()
Returns the number of changes to this node. |
Node |
cloneNode(boolean deep)
Returns a duplicate of a given node. |
boolean |
dispatchEvent(Event event)
Introduced in DOM Level 2. |
NamedNodeMap |
getAttributes()
Return the collection of attributes associated with this node, or null if none. |
NodeList |
getChildNodes()
Obtain a NodeList enumerating all children of this node. |
Node |
getFirstChild()
The first child of this Node, or null if none. |
Node |
getLastChild()
The first child of this Node, or null if none. |
int |
getLength()
NodeList method: Count the immediate children of this node |
java.lang.String |
getLocalName()
Introduced in DOM Level 2. |
java.lang.String |
getNamespaceURI()
Introduced in DOM Level 2. |
Node |
getNextSibling()
The next child of this node's parent, or null if none |
abstract java.lang.String |
getNodeName()
the name of this node. |
abstract short |
getNodeType()
A short integer indicating what type of node this is. |
java.lang.String |
getNodeValue()
Returns the node value. |
Document |
getOwnerDocument()
Find the Document that this Node belongs to (the document in whose context the Node was created). |
Node |
getParentNode()
Obtain the DOM-tree parent of this node, or null if it is not currently active in the DOM tree (perhaps because it has just been created or removed). |
java.lang.String |
getPrefix()
Introduced in DOM Level 2. |
Node |
getPreviousSibling()
The previous child of this node's parent, or null if none |
boolean |
getReadOnly()
NON-DOM: Returns true if this node is read-only. |
java.lang.Object |
getUserData()
NON-DOM: Returns the user data associated to this node. |
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
boolean |
hasChildNodes()
Test whether this node has any children. |
Node |
insertBefore(Node newChild,
Node refChild)
Move one or more node(s) to our list of children. |
boolean |
isSupported(java.lang.String feature,
java.lang.String version)
Introduced in DOM Level 2. |
Node |
item(int index)
NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds. |
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 no adjacent Text
nodes. |
Node |
removeChild(Node oldChild)
Remove a child from this Node. |
void |
removeEventListener(java.lang.String type,
EventListener listener,
boolean useCapture)
Introduced in DOM Level 2. |
Node |
replaceChild(Node newChild,
Node oldChild)
Make newChild occupy the location that oldChild used to have. |
void |
setNodeValue(java.lang.String x)
Sets the node value. |
void |
setPrefix(java.lang.String prefix)
Introduced in DOM Level 2. |
void |
setReadOnly(boolean readOnly,
boolean deep)
NON-DOM: PR-DOM-Level-1-19980818 mentions readonly nodes in conjunction with Entities, but provides no API to support this. |
void |
setUserData(java.lang.Object data)
NON-DOM: As an alternative to subclassing the DOM, this implementation has been extended with the ability to attach an object to each node. |
protected void |
synchronizeData()
Override this method in subclass to hook in efficient internal data structure. |
java.lang.String |
toString()
NON-DOM method for debugging convenience. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final short ELEMENT_DEFINITION_NODE
protected NodeImpl ownerNode
protected short flags
protected static final short READONLY
protected static final short SYNCDATA
protected static final short SYNCCHILDREN
protected static final short OWNED
protected static final short FIRSTCHILD
protected static final short SPECIFIED
protected static final short IGNORABLEWS
protected static final short SETVALUE
protected static final boolean MUTATIONEVENTS
protected static final int MUTATION_NONE
protected static final int MUTATION_LOCAL
protected static final int MUTATION_AGGREGATE
protected static final int MUTATION_ALL
Constructor Detail |
protected NodeImpl(DocumentImpl ownerDocument)
Every Node knows what Document it belongs to.
public NodeImpl()
Method Detail |
public abstract short getNodeType()
public abstract java.lang.String getNodeName()
public java.lang.String getNodeValue()
DOMString
variable on the implementation
platform.public void setNodeValue(java.lang.String x) throws DOMException
public Node appendChild(Node newChild) throws DOMException
By default we do not accept any children, ParentNode overrides this.
,
ParentNode
public Node cloneNode(boolean deep)
Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.
public Document getOwnerDocument()
public Node getParentNode()
public Node getNextSibling()
public Node getPreviousSibling()
public NamedNodeMap getAttributes()
ElementImpl
public boolean hasAttributes()
true
if this node has any attributes,
false
otherwise.ElementImpl
public boolean hasChildNodes()
By default we do not have any children, ParentNode overrides this.
ParentNode
public NodeList getChildNodes()
NodeLists are "live"; as children are added/removed the NodeList will immediately reflect those changes. Also, the NodeList refers to the actual nodes, so changes to those nodes made via the DOM tree will be reflected in the NodeList and vice versa.
In this implementation, Nodes implement the NodeList interface and provide their own getChildNodes() support. Other DOMs may solve this differently.
public Node getFirstChild()
By default we do not have any children, ParentNode overrides this.
ParentNode
public Node getLastChild()
By default we do not have any children, ParentNode overrides this.
ParentNode
public Node insertBefore(Node newChild, Node refChild) throws DOMException
By default we do not accept any children, ParentNode overrides this.
newChild
- The Node to be moved to our subtree. As a
convenience feature, inserting a DocumentNode will instead insert
all its children.refChild
- Current child which newChild should be placed
immediately before. If refChild is null, the insertion occurs
after all existing Nodes, like appendChild().ParentNode
public Node removeChild(Node oldChild) throws DOMException
By default we do not have any children, ParentNode overrides this.
ParentNode
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
By default we do not have any children, ParentNode overrides this.
ParentNode
public int getLength()
By default we do not have any children, ParentNode overrides this.
ParentNode
public Node item(int index)
By default we do not have any children, ParentNode overrides this.
Index
- intParentNode
public void normalize()
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 no adjacent 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.
Note that this implementation simply calls normalize() on this Node's children. It is up to implementors or Node to override normalize() to take action.
public 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.
feature
- The package name of the feature to test. This is the
same name as what can be passed to the method
hasFeature on DOMImplementation.version
- This is the version number of the package name 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.public java.lang.String getNamespaceURI()
The namespace URI of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, this is always null and setting it has no effect.
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 created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
AttrNSImpl
,
ElementNSImpl
public java.lang.String getPrefix()
The namespace prefix of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is always null and setting it has no effect.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
AttrNSImpl
,
ElementNSImpl
public void setPrefix(java.lang.String prefix) throws DOMException
The namespace prefix of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is always null and setting it has no effect.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
Note that setting this attribute 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.
AttrNSImpl
,
ElementNSImpl
public 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, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is the same as the nodeName attribute.
AttrNSImpl
,
ElementNSImpl
public void addEventListener(java.lang.String type, EventListener listener, boolean useCapture)
Register an event listener with this Node. A listener may be independently registered as both Capturing and Bubbling, but may only be registered once per role; redundant registrations are ignored.
type
- Event name (NOT event group!) to listen for.listener
- Who gets called when event is dispatcheduseCapture
- True iff listener is registered on
capturing phase rather than at-target or bubblingpublic void removeEventListener(java.lang.String type, EventListener listener, boolean useCapture)
Deregister an event listener previously registered with this Node. A listener must be independently removed from the Capturing and Bubbling roles. Redundant removals (of listeners not currently registered for this role) are ignored.
type
- Event name (NOT event group!) to listen for.listener
- Who gets called when event is dispatcheduseCapture
- True iff listener is registered on
capturing phase rather than at-target or bubblingpublic boolean dispatchEvent(Event event)
Distribution engine for DOM Level 2 Events.
Event propagation runs as follows:
Note that (de)registration of handlers during processing of an event does not take effect during this phase of this event; they will not be called until the next time this node is visited by dispatchEvent.
If an event handler itself causes events to be dispatched, they are processed synchronously, before processing resumes on the event which triggered them. Please be aware that this may result in events arriving at listeners "out of order" relative to the actual sequence of requests.
Note that our implementation resets the event's stop/prevent flags when dispatch begins. I believe the DOM's intent is that event objects be redispatchable, though it isn't stated in those terms.
event
- the event object to be dispatched to
registered EventListenerspreventDefault()
method was invoked by an EventListener; otherwise false.public void setReadOnly(boolean readOnly, boolean deep)
Most DOM users should not touch this method. Its anticpated use is during construction of EntityRefernces, where it will be used to lock the contents replicated from Entity so they can't be casually altered. It _could_ be published as a DOM extension, if desired.
Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.
readOnly
- True or false as desired.deep
- If true, children are also toggled. Note that this will
not change the state of an EntityReference or its children,
which are always read-only.ParentNode
public boolean getReadOnly()
public void setUserData(java.lang.Object data)
Important Note: You are responsible for removing references to your data on nodes that are no longer used. Failure to do so will prevent the nodes, your data is attached to, to be garbage collected until the whole document is.
data
- the object to store or null to remove any existing referencepublic java.lang.Object getUserData()
protected void changed()
protected int changes()
protected void synchronizeData()
public java.lang.String toString()
|
Xerces 3.1.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |