[All Packages]  [This Package]  [Previous Class]  [Next Class]

Class: Document

This class contains methods for creating and retrieving nodes.


Method Index

createAttribute Create an ATTRIBUTE node
createCDATASection Create a CDATA node
createComment Create a COMMENT node
createDocumentFragment Create a DOCUMENT_FRAGMENT node
createElement Create an ELEMENT node
createEntityReference Create an ENTITY_REFERENCE node
createProcessingInstruction Create a PROCESSING_INSTRUCTION node
createTextNode Create a TEXT node
getElementsByTagName Select nodes based on tag name
getImplementation Return DTD for document

Methods

createAttribute

Function:
Create a new attribute node. Use setValue to set its value.

Prototype:
Attr* createAttribute(String name)

Arguments:
name -- name of attribute

Returns:
Attr* -- pointer to created node

createCDATASection

Function:
Create a new CDATA node with the given contents.

Prototype:
Attr* createCDATASection(String name)

Arguments:
data -- contents of node

Returns:
CDATASection* -- pointer to created node

createComment

Function:
Create a new comment node with the given contents.

Prototype:
Comment* createComment(String data)

Arguments:
data -- contents of node

Returns:
Comment* -- pointer to created node

createDocumentFragment

Function:
Create a new document fragment node.

Prototype:
DocumentFragment* createDocumentFragment()

Arguments:
None

Returns:
DocumentFragment* -- pointer to created node

createElement

Function:
Create a new element node with the given (tag) name.

Prototype:
Element* createElement(String tagName)

Arguments:
tagName -- element's tagname

Returns:
Element* -- pointer to created node

createEntityReference

Function:
Create a new entity reference node.

Prototype:
EntityReference* createEntityReference(String name)

Arguments:
name -- name of entity to reference

Returns:
EntityReference* -- pointer to created node

createProcessingInstruction

Function:
Create a new processing instruction node.

Prototype:
ProcessingInstruction* createProcessingInstruction(String target, String data)

Arguments:
target -- target part of PI
data -- data for node

Returns:
ProcessingInstruction* -- pointer to created node

createTextNode

Function:
Create a new TEXT node.

Prototype:
Text* createTextNode(String data)

Arguments:
data -- data for node

Returns:
Text* -- pointer to created node

getElementsByTagName

Function:
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. The special value "*" matches all tags.

Prototype:
NodeList* getElementsByTagName(String tagname)

Arguments:
tagname -- tag name to select

Returns:
NodeList* -- list of matches, NULL if none

getImplementation

Function:
Returns the DOMImplementation structure, currently useless. Perhaps it will be used in later DOM versions.

Prototype:
DOMImplementation* getImplementation()

Arguments:
None

Returns:
DOMImplementation* -- pointer to structure