|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.novell.xml.dom.NodeDecorator
An abstract class for DOM node decorators. This class implements the
org.w3c.dom.Node interface and simply delegates all method
calls to another node. The intent is that NodeDecorator
subclasses will override one or more methods to modify the DOM-defined
behavior. This allows the behavior of existing DOM nodes to be modified
without subclassing those nodes. See the Decorator pattern described in
Design Paterns, Gamma, et. al.
| Field Summary | |
protected Node |
node
The node being decorated. |
| 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 | |
NodeDecorator(Node node)
Constructs a new node decorator that decorates the specified node. |
|
| Method Summary | |
Node |
appendChild(Node newChild)
DOM-defined method that adds the specified node to the end of the list of children of this node. |
Node |
cloneNode(boolean deep)
DOM-defined method that returns a duplicate of this node. |
NamedNodeMap |
getAttributes()
DOM-defined method that returns a NamedNameMap containing
the attributes of this node (if it is an Element) or
null otherwise. |
NodeList |
getChildNodes()
DOM-defined method that returns a NodeList containing all
children of this node. |
Node |
getFirstChild()
DOM-defined method that returns the first child of this node. |
Node |
getLastChild()
DOM-defined method that returns the last child of this node. |
String |
getLocalName()
Returns the local part of the qualified name of this node. |
String |
getNamespaceURI()
The namespace URI of this node, or null if it is
unspecified.
|
Node |
getNextSibling()
DOM-defined method that returns the node immediately following this node. |
String |
getNodeName()
DOM-defined method that returns the name of this node, depending on its type. |
short |
getNodeType()
DOM-defined method that returns a code representing the type of the underlying object. |
String |
getNodeValue()
DOM-defined method that returns the value of this node, depending on its type. |
Document |
getOwnerDocument()
DOM-defined method that returns the Document object
associated with this node. |
Node |
getParentNode()
DOM-defined method that returns the parent of this node. |
String |
getPrefix()
The namespace prefix of this node, or null if it is
unspecified.
|
Node |
getPreviousSibling()
DOM-defined method that returns the node immediately preceding this node. |
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
boolean |
hasChildNodes()
DOM-defined convenience method that returns whether this node has any children. |
Node |
insertBefore(Node newChild,
Node refChild)
DOM-defined method that inserts the node newChild before the existing child node refChild. |
boolean |
isSupported(String feature,
String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. |
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 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. |
Node |
removeChild(Node oldChild)
DOM-defined method that removes the child node indicated by oldChild from the list of children, and returns it. |
Node |
replaceChild(Node newChild,
Node oldChild)
DOM-defined method that replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. |
void |
setNodeValue(String nodeValue)
DOM-defined method that sets the value of this node, depending on its type. |
void |
setPrefix(String prefix)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Node node
| Constructor Detail |
public NodeDecorator(Node node)
node - the node to decorate| Method Detail |
public Node appendChild(Node newChild)
throws DOMException
appendChild in interface NodeDOMExceptionpublic Node cloneNode(boolean deep)
cloneNode in interface Nodepublic NamedNodeMap getAttributes()
NamedNameMap containing
the attributes of this node (if it is an Element) or
null otherwise.
getAttributes in interface Nodepublic NodeList getChildNodes()
NodeList containing all
children of this node.
getChildNodes in interface Nodepublic Node getFirstChild()
getFirstChild in interface Nodepublic Node getLastChild()
getLastChild in interface Nodepublic Node getNextSibling()
getNextSibling in interface Nodepublic String getNodeName()
getNodeName in interface Nodepublic short getNodeType()
getNodeType in interface Node
public String getNodeValue()
throws DOMException
getNodeValue in interface NodeDOMExceptionpublic Document getOwnerDocument()
Document object
associated with this node. This is also the Document object
used to create new nodes. When this node is a Document,
this is null.
getOwnerDocument in interface Nodepublic Node getParentNode()
Document, DocumentFragment, and
Attr may have a parent.
getParentNode in interface Nodepublic Node getPreviousSibling()
getPreviousSibling in interface Nodepublic boolean hasChildNodes()
hasChildNodes in interface Node
public Node insertBefore(Node newChild,
Node refChild)
throws DOMException
insertBefore in interface NodeDOMException
public Node removeChild(Node oldChild)
throws DOMException
removeChild in interface NodeDOMException
public Node replaceChild(Node newChild,
Node oldChild)
throws DOMException
replaceChild in interface NodeDOMException
public void setNodeValue(String nodeValue)
throws DOMException
setNodeValue in interface NodeDOMExceptionpublic void normalize()
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. 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.
normalize in interface Node
public boolean isSupported(String feature,
String version)
isSupported in interface Nodefeature - The name of the feature to test. This is the same name
which can be passed to the method hasFeature on
DOMImplementation.version - This is the version number of the feature 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.
true if the specified feature is
supported on this node, false otherwise.public String getNamespaceURI()
null if it is
unspecified.
ELEMENT_NODE and
ATTRIBUTE_NODE and nodes created with a DOM Level 1
method, such as createElement from the
Document interface, this is always null.Per
the Namespaces in XML Specification an attribute does not inherit
its namespace from the element it is attached to. If an attribute is
not explicitly given a namespace, it simply has no namespace.
getNamespaceURI in interface Nodepublic String getPrefix()
null if it is
unspecified.
nodeName attribute, which holds the qualified name, as
well as the tagName and name attributes of
the Element and Attr interfaces, when
applicable.
namespaceURI and localName do not change.
ELEMENT_NODE and
ATTRIBUTE_NODE and nodes created with a DOM Level 1
method, such as createElement from the
Document interface, this is always null.
getPrefix in interface NodeDOMException - INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
illegal character.
prefix is
malformed, if the namespaceURI of this node is
null, if the specified prefix is "xml" and the
namespaceURI of this node is different from "
http://www.w3.org/XML/1998/namespace", if this node is an attribute
and the specified prefix is "xmlns" and the
namespaceURI of this node is different from "
http://www.w3.org/2000/xmlns/", or if this node is an attribute and
the qualifiedName of this node is "xmlns" .
public void setPrefix(String prefix)
throws DOMException
setPrefix in interface NodeDOMExceptionpublic String getLocalName()
ELEMENT_NODE and
ATTRIBUTE_NODE and nodes created with a DOM Level 1
method, such as createElement from the
Document interface, this is always null.
getLocalName in interface Nodepublic boolean hasAttributes()
hasAttributes in interface Nodetrue if this node has any attributes,
false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||