Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weblogic.apache.xerces.dom
Class NodeImpl

    java.lang.Object
      |
      +--weblogic.apache.xerces.dom.NodeImpl

Direct Known Subclasses:
  AttrImpl, ChildNode, NotationImpl

public abstract class NodeImpl
extends java.lang.Object
implements org.w3c.dom.Node, org.w3c.dom.NodeList, org.w3c.dom.events.EventTarget, java.lang.Cloneable, java.io.Serializable

NodeImpl provides the basic structure of a DOM tree. It is never used directly, but instead is subclassed to add type and data information, and additional methods, appropriate to each node of the tree. Only its subclasses should be instantiated -- and those, with the exception of Document itself, only through a specific Document's factory methods.

The Node interface provides shared behaviors such as siblings and children, both for consistancy and so that the most common tree operations may be performed without constantly having to downcast to specific node types. When there is no obvious mapping for one of these queries, it will respond with null. Note that the default behavior is that children are forbidden. To permit them, the subclass ParentNode overrides several methods.

NodeImpl also implements NodeList, so it can return itself in response to the getChildNodes() query. This eliminiates the need for a separate ChildNodeList object. Note that this is an IMPLEMENTATION DETAIL; applications should _never_ assume that this identity exists.

All nodes in a single document must originate in that document. (Note that this is much tighter than "must be same implementation") Nodes are all aware of their ownerDocument, and attempts to mismatch will throw WRONG_DOCUMENT_ERR.

However, to save memory not all nodes always have a direct reference to their ownerDocument. When a node is owned by another node it relies on its owner to store its ownerDocument. Parent nodes always store it though, so there is never more than one level of indirection. And when a node doesn't have an owner, ownerNode refers to its ownerDocument.

This class doesn't directly support mutation events, however, it still implements the EventTarget interface and forward all related calls to the document so that the document class do so.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Author:
  Arnaud Le Hors, IBM, Joe Kesselman, IBM
See Also:
  Serialized Form

Field Summary
`static short` | `ELEMENT_DEFINITION_NODE` Element definition node type.
`protected static short` | `FIRSTCHILD`
`protected short` | `flags`
`protected static short` | `HASSTRING`
`protected static short` | `IGNORABLEWS`
`protected static short` | `OWNED`
`protected NodeImpl` | `ownerNode`
`protected static short` | `READONLY`
`protected static short` | `SPECIFIED`
`protected static short` | `SYNCCHILDREN`
`protected static short` | `SYNCDATA`
`protected static short` | `UNNORMALIZED`

Constructor Summary
`` | `NodeImpl()` Constructor for serialization.
`protected` | `NodeImpl(CoreDocumentImpl 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, org.w3c.dom.events.EventListener listener, boolean useCapture)`
`org.w3c.dom.Node` | `appendChild(org.w3c.dom.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.
`org.w3c.dom.Node` | `cloneNode(boolean deep)` Returns a duplicate of a given node.
`boolean` | `dispatchEvent(org.w3c.dom.events.Event event)`
`org.w3c.dom.NamedNodeMap` | `getAttributes()` Return the collection of attributes associated with this node, or null if none.
`org.w3c.dom.NodeList` | `getChildNodes()` Obtain a NodeList enumerating all children of this node.
`org.w3c.dom.Node` | `getFirstChild()` The first child of this Node, or null if none.
`org.w3c.dom.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.
`org.w3c.dom.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.
`org.w3c.dom.Document` | `getOwnerDocument()` Find the Document that this Node belongs to (the document in whose context the Node was created).
`org.w3c.dom.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.
`org.w3c.dom.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.
`org.w3c.dom.Node` | `insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.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.
`org.w3c.dom.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.
`org.w3c.dom.Node` | `removeChild(org.w3c.dom.Node oldChild)` Remove a child from this Node.
`void` | `removeEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)`
`org.w3c.dom.Node` | `replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.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

### ELEMENT_DEFINITION_NODE

    public static final short ELEMENT_DEFINITION_NODE

  Element definition node type.

### ownerNode

    protected NodeImpl ownerNode

### flags

    protected short flags

### READONLY

    protected static final short READONLY

### SYNCDATA

    protected static final short SYNCDATA

### SYNCCHILDREN

    protected static final short SYNCCHILDREN

### OWNED

    protected static final short OWNED

### FIRSTCHILD

    protected static final short FIRSTCHILD

### SPECIFIED

    protected static final short SPECIFIED

### IGNORABLEWS

    protected static final short IGNORABLEWS

### HASSTRING

    protected static final short HASSTRING

### UNNORMALIZED

    protected static final short UNNORMALIZED

Constructor Detail

### NodeImpl

    protected NodeImpl(CoreDocumentImpl ownerDocument)

  No public constructor; only subclasses of Node should be instantiated, and those normally via a Document's factory methods

  Every Node knows what Document it belongs to.

### NodeImpl

    public NodeImpl()

  Constructor for serialization.

Method Detail

### getNodeType

    public abstract short getNodeType()

  A short integer indicating what type of node this is. The named constants for this value are defined in the org.w3c.dom.Node interface.
  Specified by:
    getNodeType in interface org.w3c.dom.Node

### getNodeName

    public abstract java.lang.String getNodeName()

  the name of this node.
  Specified by:
    getNodeName in interface org.w3c.dom.Node

### getNodeValue

    public java.lang.String getNodeValue()

  Returns the node value.
  Specified by:
    getNodeValue in interface org.w3c.dom.Node

### setNodeValue

    public void setNodeValue(java.lang.String x)
                      throws org.w3c.dom.DOMException

  Sets the node value.
  Specified by:
    setNodeValue in interface org.w3c.dom.Node

  Throws:
    DOMException(NO_MODIFICATION_ALLOWED_ERR) -

### appendChild

    public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                                 throws org.w3c.dom.DOMException

  Adds a child node to the end of the list of children for this node. Convenience shorthand for insertBefore(newChild,null).
  Specified by:
    appendChild in interface org.w3c.dom.Node

  Throws:
    DOMException(HIERARCHY_REQUEST_ERR) - if newChild is of a type that shouldn't be a child of this node.
    DOMException(WRONG_DOCUMENT_ERR) - if newChild has a different owner document than we do.
    DOMException(NO_MODIFICATION_ALLOWED_ERR) - if this node is read-only.
  See Also:

    By default we do not accept any children, ParentNode overrides this.

    , `ParentNode`

### cloneNode

    public org.w3c.dom.Node cloneNode(boolean deep)

  Returns a duplicate of a given node. You can consider this a generic "copy constructor" for nodes. The newly returned object should be completely independent of the source object's subtree, so changes in one after the clone has been made will not affect the other.

  Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.

  Specified by:
    cloneNode in interface org.w3c.dom.Node

  See Also:

    Example: Cloning a Text node will copy both the node and the text it contains.

    Example: Cloning something that has children -- Element or Attr, for example -- will _not_ clone those children unless a "deep clone" has been requested. A shallow clone of an Attr node will yield an empty Attr of the same name.

    NOTE: Clones will always be read/write, even if the node being cloned is read-only, to permit applications using only the DOM API to obtain editable copies of locked portions of the tree.

### getOwnerDocument

    public org.w3c.dom.Document getOwnerDocument()

  Find the Document that this Node belongs to (the document in whose context the Node was created). The Node may or may not currently be part of that Document's actual contents.
  Specified by:
    getOwnerDocument in interface org.w3c.dom.Node

### getParentNode

    public org.w3c.dom.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). Note that Document, DocumentFragment, and Attribute will never have parents.
  Specified by:
    getParentNode in interface org.w3c.dom.Node

### getNextSibling

    public org.w3c.dom.Node getNextSibling()

  The next child of this node's parent, or null if none
  Specified by:
    getNextSibling in interface org.w3c.dom.Node

### getPreviousSibling

    public org.w3c.dom.Node getPreviousSibling()

  The previous child of this node's parent, or null if none
  Specified by:
    getPreviousSibling in interface org.w3c.dom.Node

### getAttributes

    public org.w3c.dom.NamedNodeMap getAttributes()

  Return the collection of attributes associated with this node, or null if none. At this writing, Element is the only type of node which will ever have attributes.
  Specified by:
    getAttributes in interface org.w3c.dom.Node

  See Also:
    `ElementImpl`

### hasAttributes

    public boolean hasAttributes()

  Returns whether this node (if it is an element) has any attributes.
  Specified by:
    hasAttributes in interface org.w3c.dom.Node

  Returns:
    `true` if this node has any attributes, `false` otherwise.
  See Also:
    `ElementImpl`

### hasChildNodes

    public boolean hasChildNodes()

  Test whether this node has any children. Convenience shorthand for (Node.getFirstChild()!=null)

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    hasChildNodes in interface org.w3c.dom.Node

  See Also:
    `ParentNode`

### getChildNodes

    public org.w3c.dom.NodeList getChildNodes()

  Obtain a NodeList enumerating all children of this node. If there are none, an (initially) empty NodeList is returned.

  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.

  Specified by:
    getChildNodes in interface org.w3c.dom.Node

### getFirstChild

    public org.w3c.dom.Node getFirstChild()

  The first child of this Node, or null if none.

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    getFirstChild in interface org.w3c.dom.Node

  See Also:
    `ParentNode`

### getLastChild

    public org.w3c.dom.Node getLastChild()

  The first child of this Node, or null if none.

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    getLastChild in interface org.w3c.dom.Node

  See Also:
    `ParentNode`

### insertBefore

    public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                         org.w3c.dom.Node refChild)
                                  throws org.w3c.dom.DOMException

  Move one or more node(s) to our list of children. Note that this implicitly removes them from their previous parent.

  By default we do not accept any children, ParentNode overrides this.

  Specified by:
    insertBefore in interface org.w3c.dom.Node

  Parameters:
    `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().
  Throws:
    DOMException(HIERARCHY_REQUEST_ERR) - if newChild is of a type that shouldn't be a child of this node, or if newChild is an ancestor of this node.
    DOMException(WRONG_DOCUMENT_ERR) - if newChild has a different owner document than we do.
    DOMException(NOT_FOUND_ERR) - if refChild is not a child of this node.
    DOMException(NO_MODIFICATION_ALLOWED_ERR) - if this node is read-only.
  See Also:
    `ParentNode`

### removeChild

    public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                                 throws org.w3c.dom.DOMException

  Remove a child from this Node. The removed child's subtree remains intact so it may be re-inserted elsewhere.

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    removeChild in interface org.w3c.dom.Node

  Returns:
    oldChild, in its new state (removed).
  Throws:
    DOMException(NOT_FOUND_ERR) - if oldChild is not a child of this node.
    DOMException(NO_MODIFICATION_ALLOWED_ERR) - if this node is read-only.
  See Also:
    `ParentNode`

### replaceChild

    public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                         org.w3c.dom.Node oldChild)
                                  throws org.w3c.dom.DOMException

  Make newChild occupy the location that oldChild used to have. Note that newChild will first be removed from its previous parent, if any. Equivalent to inserting newChild before oldChild, then removing oldChild.

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    replaceChild in interface org.w3c.dom.Node

  Throws:
    DOMException(HIERARCHY_REQUEST_ERR) - if newChild is of a type that shouldn't be a child of this node, or if newChild is one of our ancestors.
    DOMException(WRONG_DOCUMENT_ERR) - if newChild has a different owner document than we do.
    DOMException(NOT_FOUND_ERR) - if oldChild is not a child of this node.
    DOMException(NO_MODIFICATION_ALLOWED_ERR) - if this node is read-only.
  See Also:
    `ParentNode`

### getLength

    public int getLength()

  NodeList method: Count the immediate children of this node

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    getLength in interface org.w3c.dom.NodeList

  Returns:
    int
  See Also:
    `ParentNode`

### item

    public org.w3c.dom.Node item(int index)

  NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds.

  By default we do not have any children, ParentNode overrides this.

  Specified by:
    item in interface org.w3c.dom.NodeList

  Parameters:
    `Index` - int
  Returns:
    org.w3c.dom.Node
  See Also:
    `ParentNode`

### 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 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.

  Specified by:
    normalize in interface org.w3c.dom.Node

### isSupported

    public boolean isSupported(java.lang.String feature,
                               java.lang.String version)

  Introduced in DOM Level 2.

  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 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.
  Returns:
    boolean Returns true if this node defines a subtree within which the specified feature is supported, false otherwise.

### getNamespaceURI

    public java.lang.String getNamespaceURI()

  Introduced in DOM Level 2.

  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.

  Specified by:
    getNamespaceURI in interface org.w3c.dom.Node

  See Also:
    `AttrNSImpl`, `ElementNSImpl`

### getPrefix

    public java.lang.String getPrefix()

  Introduced in DOM Level 2.

  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.

  Specified by:
    getPrefix in interface org.w3c.dom.Node

  See Also:
    `AttrNSImpl`, `ElementNSImpl`

### setPrefix

    public void setPrefix(java.lang.String prefix)
                   throws org.w3c.dom.DOMException

  Introduced in DOM Level 2.

  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.

  Specified by:
    setPrefix in interface org.w3c.dom.Node

  Throws:
    INVALID_CHARACTER_ERR - Raised if the specified prefix contains an invalid character.
  See Also:
    `AttrNSImpl`, `ElementNSImpl`

### getLocalName

    public java.lang.String getLocalName()

  Introduced in DOM Level 2.

  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.

  Specified by:
    getLocalName in interface org.w3c.dom.Node

  See Also:
    `AttrNSImpl`, `ElementNSImpl`

### addEventListener

    public void addEventListener(java.lang.String type,
                                 org.w3c.dom.events.EventListener listener,
                                 boolean useCapture)

  Specified by:
    addEventListener in interface org.w3c.dom.events.EventTarget

### removeEventListener

    public void removeEventListener(java.lang.String type,
                                    org.w3c.dom.events.EventListener listener,
                                    boolean useCapture)

  Specified by:
    removeEventListener in interface org.w3c.dom.events.EventTarget

### dispatchEvent

    public boolean dispatchEvent(org.w3c.dom.events.Event event)

  Specified by:
    dispatchEvent in interface org.w3c.dom.events.EventTarget

### setReadOnly

    public 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.

  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.

  Parameters:
    `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.
  See Also:
    `ParentNode`

### getReadOnly

    public boolean getReadOnly()

  NON-DOM: Returns true if this node is read-only. This is a shallow check.

### setUserData

    public 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. (If you need multiple objects, you can attach a collection such as a vector or hashtable, then attach your application information to that.)

  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.

  Parameters:
    `data` - the object to store or null to remove any existing reference

### getUserData

    public java.lang.Object getUserData()

  NON-DOM: Returns the user data associated to this node.

### changed

    protected void changed()

  Denotes that this node has changed.

### changes

    protected int changes()

  Returns the number of changes to this node.

### synchronizeData

    protected void synchronizeData()

  Override this method in subclass to hook in efficient internal data structure.

### toString

    public java.lang.String toString()

  NON-DOM method for debugging convenience.

  Overrides:
    toString in class java.lang.Object

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs70
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference