Google Web Toolkit (Beta)
Search this site:

# Interface Node

public interface Node
// Extended by `ProcessingInstruction`, `EntityReference`, `Element`, `DocumentFragment`, `Document`, `CharacterData`, `Attr`
This is the base interface for DOM nodes, as obtained from using `XMLParser` methods. Methods for iterating over and accessing values from nodes are supplied here.

## Fields

ATTRIBUTE_NODE | The constant 2 denotes DOM nodes of type Attribute.
CDATA_SECTION_NODE | The constant 4 denotes DOM nodes of type CdataSection.
COMMENT_NODE | The constant 8 denotes DOM nodes of type Comment.
DOCUMENT_FRAGMENT_NODE | The constant 11 denotes DOM nodes of type DocumentFragment.
DOCUMENT_NODE | The constant 9 denotes DOM nodes of type Document.
DOCUMENT_TYPE_NODE | The constant 10 denotes DOM nodes of type DocumentType.
ELEMENT_NODE | The constant 1 denotes DOM nodes of type Element.
ENTITY_NODE | The constant 6 denotes DOM nodes of type Entity.
ENTITY_REFERENCE_NODE | The constant 5 denotes DOM nodes of type EntityReference.
NOTATION_NODE | The constant 12 denotes DOM nodes of type Notation.
PROCESSING_INSTRUCTION_NODE | The constant 7 denotes DOM nodes of type ProcessingInstruction.
TEXT_NODE | The constant 3 denotes DOM nodes of type Text.

## Methods

appendChild(Node) | This method appends child `newChild`.
cloneNode(boolean) | This method copies this `Node`.
getAttributes() | This method retrieves the attributes.
getChildNodes() | This method retrieves the child nodes.
getFirstChild() | This method retrieves the first child.
getLastChild() | This method retrieves the last child.
getNamespaceURI() | This method retrieves the namespace URI.
getNextSibling() | This method retrieves the next sibling.
getNodeName() | This method retrieves the name.
getNodeType() | This method retrieves the type.
getNodeValue() | This method retrieves the value.
getOwnerDocument() | This method retrieves the owner document.
getParentNode() | This method retrieves the parent.
getPrefix() | This method retrieves the prefix.
getPreviousSibling() | This method retrieves the previous sibling.
hasAttributes() | This method determines whether this `Node` has any attributes.
hasChildNodes() | This method determines whether this `Node` has any child nodes.
insertBefore(Node, Node) | This method inserts before `newChild`.
normalize() | This method may collapse adjacent text nodes into one text node, depending on the implementation.
removeChild(Node) | This method removes child `oldChild`.
replaceChild(Node, Node) | This method replaces the child `oldChild` with `newChild`.
setNodeValue(String) | This method sets the value to `nodeValue`.

## Field Detail

### ATTRIBUTE_NODE

public static final short ATTRIBUTE_NODE
The constant 2 denotes DOM nodes of type Attribute.

### CDATA_SECTION_NODE

public static final short CDATA_SECTION_NODE
The constant 4 denotes DOM nodes of type CdataSection.

### COMMENT_NODE

public static final short COMMENT_NODE
The constant 8 denotes DOM nodes of type Comment.

### DOCUMENT_FRAGMENT_NODE

public static final short DOCUMENT_FRAGMENT_NODE
The constant 11 denotes DOM nodes of type DocumentFragment.

### DOCUMENT_NODE

public static final short DOCUMENT_NODE
The constant 9 denotes DOM nodes of type Document.

### DOCUMENT_TYPE_NODE

public static final short DOCUMENT_TYPE_NODE
The constant 10 denotes DOM nodes of type DocumentType.

### ELEMENT_NODE

public static final short ELEMENT_NODE
The constant 1 denotes DOM nodes of type Element.

### ENTITY_NODE

public static final short ENTITY_NODE
The constant 6 denotes DOM nodes of type Entity.

### ENTITY_REFERENCE_NODE

public static final short ENTITY_REFERENCE_NODE
The constant 5 denotes DOM nodes of type EntityReference.

### NOTATION_NODE

public static final short NOTATION_NODE
The constant 12 denotes DOM nodes of type Notation.

### PROCESSING_INSTRUCTION_NODE

public static final short PROCESSING_INSTRUCTION_NODE
The constant 7 denotes DOM nodes of type ProcessingInstruction.

### TEXT_NODE

public static final short TEXT_NODE
The constant 3 denotes DOM nodes of type Text.

## Method Detail

### appendChild

public Node appendChild(Node newChild)
This method appends child `newChild`.

#### Parameters

newChild
  the `Node` to be added

#### Return Value

the child `Node` appended

### cloneNode

public Node cloneNode(boolean deep)
This method copies this `Node`.

#### Parameters

deep
  whether to recurse to children

#### Return Value

`Node` cloned

### getAttributes

public NamedNodeMap getAttributes()
This method retrieves the attributes.

#### Return Value

the attributes of this `Node`

### getChildNodes

public NodeList getChildNodes()
This method retrieves the child nodes.

#### Return Value

the child nodes of this `Node`

### getFirstChild

public Node getFirstChild()
This method retrieves the first child.

#### Return Value

the first child of this `Node`

### getLastChild

public Node getLastChild()
This method retrieves the last child.

#### Return Value

the last child of this `Node`

### getNamespaceURI

public String getNamespaceURI()
This method retrieves the namespace URI.

#### Return Value

the namespace URI of this `Node`

### getNextSibling

public Node getNextSibling()
This method retrieves the next sibling.

#### Return Value

the next sibling of this `Node`

### getNodeName

public String getNodeName()
This method retrieves the name.

#### Return Value

the name of this `Node`

### getNodeType

public short getNodeType()
This method retrieves the type.

#### Return Value

the type of this `Node`

### getNodeValue

public String getNodeValue()
This method retrieves the value.

#### Return Value

the value of this `Node`

### getOwnerDocument

public Document getOwnerDocument()
This method retrieves the owner document.

#### Return Value

the owner document of this `Node`

### getParentNode

public Node getParentNode()
This method retrieves the parent.

#### Return Value

the parent of this `Node`

### getPrefix

public String getPrefix()
This method retrieves the prefix.

#### Return Value

the prefix of this `Node`

### getPreviousSibling

public Node getPreviousSibling()
This method retrieves the previous sibling.

#### Return Value

the previous sibling of this `Node`

### hasAttributes

public boolean hasAttributes()
This method determines whether this `Node` has any attributes.

#### Return Value

`true` if this `Node` has any attributes

### hasChildNodes

public boolean hasChildNodes()
This method determines whether this `Node` has any child nodes.

#### Return Value

`true` if this `Node` has any child nodes

### insertBefore

public Node insertBefore(Node newChild, Node refChild)
This method inserts before `newChild`.

#### Parameters

newChild
  the `Node` to be added
refChild
  the `Node` which determines the position to insert

#### Return Value

the before `Node` inserted

### normalize

public void normalize()
This method may collapse adjacent text nodes into one text node, depending on the implementation.

### removeChild

public Node removeChild(Node oldChild)
This method removes child `oldChild`.

#### Parameters

oldChild
  the `Node` to be removed

#### Return Value

the child `Node` removed

### replaceChild

public Node replaceChild(Node newChild, Node oldChild)
This method replaces the child `oldChild` with `newChild`.

#### Parameters

newChild
  the `Node` to be added
oldChild
  the `Node` to be removed

#### Return Value

the child `Node` replaced

### setNodeValue

public void setNodeValue(String nodeValue)
This method sets the value to `nodeValue`.

#### Parameters

nodeValue
  the new value