Google Web Toolkit
Search Google Code:

# Interface Document

public interface Document
extends Node
`Document` objects represent XML documents. Each `Document` can contain exactly one `Element` node, and any number of other node types.

## Methods

createCDATASection(String) | This method creates a new `CDATASection`.
createComment(String) | This method creates a new `Comment`.
createDocumentFragment() | This method creates a new `DocumentFragment`.
createElement(String) | This method creates a new `Element`.
createProcessingInstruction(String, String) | This method creates a new `ProcessingInstruction`.
createTextNode(String) | This method creates a new `Text`.
getDocumentElement() | This method retrieves the document element.
getElementById(String) | This method retrieves the unique descendent elements which has an id of `elementId`.
getElementsByTagName(String) | This method retrieves any descendent elements which have a tag name of `tagname`.
importNode(Node, boolean) | This method imports a node into the current `Document`.

## Method Detail

### createCDATASection

public CDATASection createCDATASection(String data)
This method creates a new `CDATASection`.

#### Parameters

data
  the data of the new `CDATASection`

#### Return Value

the newly created `CDATASection`

### createComment

public Comment createComment(String data)
This method creates a new `Comment`.

#### Parameters

data
  the data of the new `Comment`

#### Return Value

the newly created `Comment`

### createDocumentFragment

public DocumentFragment createDocumentFragment()
This method creates a new `DocumentFragment`.

#### Return Value

the newly created `DocumentFragment`

### createElement

public Element createElement(String tagName)
This method creates a new `Element`.

#### Parameters

tagName
  the tag name of the new `Element`

#### Return Value

the newly created `Element`

### createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(String target, String data)
This method creates a new `ProcessingInstruction`.

#### Parameters

target
  the target of the new `ProcessingInstruction`
data
  the data of the new `ProcessingInstruction`

#### Return Value

the newly created `ProcessingInstruction`

### createTextNode

public Text createTextNode(String data)
This method creates a new `Text`.

#### Parameters

data
  the data of the new `Text`

#### Return Value

the newly created `Text`

### getDocumentElement

public Element getDocumentElement()
This method retrieves the document element. Each document has at most one `Element` as its direct child, and this node is returned if it exists. `null` is returned otherwise.

#### Return Value

the document element of this `Document`

### getElementById

public Element getElementById(String elementId)
This method retrieves the unique descendent elements which has an id of `elementId`. Note the attribute which is used as an ID must be supplied in the DTD of the document. It is not sufficient to give the `Element` to be retrieved an attribute named 'id'.

#### Parameters

elementId

#### Return Value

the `Element` which has an id of `elementId` and belongs to this `Document`

### getElementsByTagName

public NodeList getElementsByTagName(String tagname)
This method retrieves any descendent elements which have a tag name of `tagname`.

#### Parameters

tagname

#### Return Value

the `NodeList` of elements which has a tag name of `tagname` and belong to this `Document`

### importNode

public Node importNode(Node importedNode, boolean deep)
This method imports a node into the current `Document`.

#### Parameters

importedNode
deep
  whether to recurse to children

#### Return Value

the node `Node` imported