DOM::Document Class Reference

#include <DOM.hpp>

Inheritance diagram for DOM::Document:

DOM::Node List of all members.

Detailed Description

The Document class is here.


Public Member Functions

const NodeappendChild (const Node *newNode)
 Append a child to the children list.
virtual const NamedNodeMapattributes () const
 Get the attributes (if this node is an Element).
NodeListchildNodes () const
 Get the child nodes.
NodecloneNode (bool deepCloning) const throw ()
 Clone this node This methods returns a duplicate for this node, but the returned node has no parent.
AttrcreateAttribute (const DOMString &name) const
 Create an attribute node with the specified name If the name is a valid HTML4.01 attribue name, then the returned attribute can be casted to the expected interface for such attribute.
AttrcreateAttributeNS (const DOMString &namespaceURI, const DOMString &qualifiedName) const
 Create an attribute with namespace Not implemented in this implementation, it always returns 0.
CDATASectioncreateCDATASection (const DOMString &data) const
 Create a CDATA node with the specified data.
CommentcreateComment (const DOMString &data) const throw ()
 Create a comment node with the specified data.
DocumentFragmentcreateDocumentFragment () const
 Create an empty document fragment.
ElementcreateElement (const DOMString &tagName) const
 Create an element with the given tag name If the tagName is a valid HTML4.01 tag name, then the returned element can be casted to the expected interface for such elements.
ElementcreateElementNS (const DOMString &namespaceURI, const DOMString &qualifiedName) const
 Create an element with namespace Not implemented in this implementation, it always returns 0.
EntityReferencecreateEntityReference (const DOMString &name) const
 Create an entity reference node with the specified name If the name is a valid HTML4.01 attribue name, then the returned attribute can be casted to the expected interface for such attribute.
ProcessingInstructioncreateProcessingInstruction (const DOMString &target, const DOMString &data) const
 Create an processing instruction.
TextcreateTextNode (const DOMString &data) const throw ()
 Create a text node with the specified data.
const DocumentType *const doctype () const throw ()
 Get the document type for this document.
 Document (const DOMString &namespaceURI, const DOMString &qualifiedName, const DocumentType *docType, const volatile HTML::Elements::Allocators::BaseAllocator *_allocator, DOMTree::Node *ref=0, const Element *htmlElement=0)
 Only public constructor.
const Element *const documentElement () const throw ()
 Get the document root element.
const NodefirstChild () const
 Get the first child pointer.
const NodefirstChildOfType (const NodeType::Type type) const
 Get the first child pointer of the given type.
const uint32 getChildrenCount () const throw ()
 Get the children count.
const ElementgetElementById (const DOMString &elementId) const
 Get the first element with the given ID attribute.
NodeListgetElementsByTagName (const DOMString &tagName) const throw ()
 Get a node list of the descendant elements matching the given tagName.
NodeListgetElementsByTagNameNS (const DOMString &namespaceURI, const DOMString &localName) const
 Get element by tag name and namespace Not implemented in this implementation, it always returns 0.
const uint16 getNodeType () const
 Get the node type as the DOM 2.0 standard requires it.
bool hasAttributes () const throw ()
 Does this node has attribute ?
bool hasChildNodes () const throw ()
 Does this node has children ?
const DOMImplementation *const implementation () const throw ()
 Get the current DOM implementation interface.
const NodeimportNode (const Node *importedNode, bool deep)
 Import a foreign node in this document and clone it.
const NodeinsertBefore (const Node *newNode, const Node *refNode)
 Insert a node before the given node.
const NodelastChild () const
 Get the last child pointer.
virtual DOMString localName () const
 Get the local name.
virtual DOMString namespaceURI () const
 Get the namespace URI (if specified).
const NodenextSibling () const
 Get the next node in the same current child level.
virtual DOMString nodeName () const
 Get the node name.
virtual void nodeValue (const DOMString &newValue)
 Set the node value.
virtual DOMString nodeValue () const
 Get the node value.
void normalize () throw ()
 Normalize this tree so that the tree will never have 2 adjacent Text child, or an empty Text child This is used to the tree structure is kept as minimal (normalized).
const DOM::DocumentownerDocument () const
 Get the owner document.
const NodeparentNode () const
 Get the parent node.
void prefix (const DOMString &) const
 Set the prefix.
virtual DOMString prefix () const
 Get the prefix.
const NodepreviousSibling () const
 Get the previous node in the same current child level.
const NoderemoveChild (const Node *oldNode)
 Remove a child.
const NodereplaceChild (const Node *newNode, const Node *oldNode)
 Replace a child node by another node.
virtual void returnToAllocator (const volatile HTML::Elements::Allocators::BaseAllocator *allocator)
 Return this node to the allocator.
bool setHTMLElement (const Element *htmlElement)
 Set the main element if not done already.
void setTreeNode (DOMTree::Node *newTreeNode) const
 Set the reference correctly.
void Suicide ()
 Make this node commit suicide itself.

Static Public Member Functions

static bool isSupported (const DOMString &feature, const DOMString &version)
 Tell if the given features is supported.

Public Attributes

const NodeType::Type nodeType
 The node type.

Protected Member Functions

virtual NodeClone (bool deepCopy) const throw ()
 The clone implementation.
const DOMTree::NodegetTreeNode () const
 Get the underlying tree node.
DOMTree::NodegetTreeNode ()
 Get the underlying tree node.


Constructor & Destructor Documentation

DOM::Document::Document ( const DOMString namespaceURI,
const DOMString qualifiedName,
const DocumentType docType,
const volatile HTML::Elements::Allocators::BaseAllocator _allocator,
DOMTree::Node ref = 0,
const Element htmlElement = 0 
) [inline]

Only public constructor.


Member Function Documentation

const Node* DOM::Node::appendChild ( const Node newNode  )  [inline, inherited]

Append a child to the children list.

Parameters:
newNode the new node to append to the list
Returns:
the node added

virtual const NamedNodeMap* DOM::Node::attributes (  )  const [inline, virtual, inherited]

Get the attributes (if this node is an Element).

Returns:
0 if this node is not an element, or the NamedNodeMap pointer else

Reimplemented in DOM::Element.

NodeList* DOM::Node::childNodes (  )  const [inline, inherited]

Get the child nodes.

Returns:
a pointer on a newly created NodeList object that can be used to access the child nodes

virtual Node* DOM::Node::Clone ( bool  deepCopy  )  const throw () [inline, protected, virtual, inherited]

The clone implementation.

Reimplemented in DOM::Text, DOM::Attr, DOM::Element, and DOM::Comment.

Node* DOM::Node::cloneNode ( bool  deepCloning  )  const throw () [inline, inherited]

Clone this node This methods returns a duplicate for this node, but the returned node has no parent.

This is a very long process.

Warning:
Cloning is Node type dependent, please refer to http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html for implication
Parameters:
deepCloning Does the cloning should also clone childrens
Returns:
the cloned node

Attr * DOM::Document::createAttribute ( const DOMString name  )  const

Create an attribute node with the specified name If the name is a valid HTML4.01 attribue name, then the returned attribute can be casted to the expected interface for such attribute.

Parameters:
name The attribute name
Returns:
A pointer on the created attribute node or 0 if failed
Exceptions:
Exceptions::InvalidCharacter if the name contained invalid characters

Attr* DOM::Document::createAttributeNS ( const DOMString namespaceURI,
const DOMString qualifiedName 
) const [inline]

Create an attribute with namespace Not implemented in this implementation, it always returns 0.

CDATASection* DOM::Document::createCDATASection ( const DOMString data  )  const [inline]

Create a CDATA node with the specified data.

Parameters:
data The data of the node
Returns:
A pointer on the created CDATA node or 0 if failed
Exceptions:
Exceptions::NotSupported 
Warning:
This implementation is for HTML and doesn't support CDATA, so an exception is always thrown

Comment * DOM::Document::createComment ( const DOMString data  )  const throw ()

Create a comment node with the specified data.

Parameters:
data The data of the node
Returns:
A pointer on the created Comment node or 0 if failed

DocumentFragment* DOM::Document::createDocumentFragment (  )  const [inline]

Create an empty document fragment.

Returns:
A pointer the document fragment or 0 if failed
Warning:
Current implementation doesn't support document fragment, so it always return 0
Todo:
Support document fragment

Element * DOM::Document::createElement ( const DOMString tagName  )  const

Create an element with the given tag name If the tagName is a valid HTML4.01 tag name, then the returned element can be casted to the expected interface for such elements.

Parameters:
tagName the element tag name
Returns:
A pointer on an Element object or 0 if failed
Exceptions:
Exceptions::InvalidCharacter if the tag name contained invalid characters

Element* DOM::Document::createElementNS ( const DOMString namespaceURI,
const DOMString qualifiedName 
) const [inline]

Create an element with namespace Not implemented in this implementation, it always returns 0.

EntityReference* DOM::Document::createEntityReference ( const DOMString name  )  const [inline]

Create an entity reference node with the specified name If the name is a valid HTML4.01 attribue name, then the returned attribute can be casted to the expected interface for such attribute.

Parameters:
name The attribute name
Returns:
A pointer on the created entity reference or 0 if failed
Exceptions:
Exceptions::NotSupported 
Warning:
This implementation is for HTML and doesn't support CDATA, so an exception is always thrown

ProcessingInstruction* DOM::Document::createProcessingInstruction ( const DOMString target,
const DOMString data 
) const [inline]

Create an processing instruction.

Parameters:
target the processing instruction target
data the processing instruction data
Returns:
A pointer the processing instruction or 0 if failed
Exceptions:
Exceptions::NotSupported 
Warning:
This implementation is for HTML and doesn't support processing instructions, so an exception is always thrown

Text * DOM::Document::createTextNode ( const DOMString data  )  const throw ()

Create a text node with the specified data.

Parameters:
data The data of the Text node
Returns:
A pointer on the created Text node or 0 if failed

const DocumentType* const DOM::Document::doctype (  )  const throw () [inline]

Get the document type for this document.

Returns:
a constant pointer on a constant DocumentType, or 0 if no document type if found

const Element* const DOM::Document::documentElement (  )  const throw () [inline]

Get the document root element.

Returns:
a constant pointer on a constant DOMImplemantation matching this document

const Node* DOM::Node::firstChild (  )  const [inline, inherited]

Get the first child pointer.

Returns:
the first child Node pointer or 0 if no child is available

const Node* DOM::Node::firstChildOfType ( const NodeType::Type  type  )  const [inline, inherited]

Get the first child pointer of the given type.

Parameters:
type The child type to look for
Returns:
the first child Node pointer of the given type or 0 if no child of this type is available

const uint32 DOM::Node::getChildrenCount (  )  const throw () [inline, inherited]

Get the children count.

Returns:
the number of children if known

const Element * DOM::Document::getElementById ( const DOMString elementId  )  const

Get the first element with the given ID attribute.

Parameters:
elementId the element ID attribute value to match element against
Returns:
the element pointer or 0 if not found

NodeList * DOM::Document::getElementsByTagName ( const DOMString tagName  )  const throw ()

Get a node list of the descendant elements matching the given tagName.

Parameters:
tagName The element tag name to build the list against
Returns:
a pointer on a newly created NodeList object with the element in it

NodeList* DOM::Document::getElementsByTagNameNS ( const DOMString namespaceURI,
const DOMString localName 
) const [inline]

Get element by tag name and namespace Not implemented in this implementation, it always returns 0.

const uint16 DOM::Node::getNodeType (  )  const [inline, inherited]

Get the node type as the DOM 2.0 standard requires it.

const DOMTree::Node* DOM::Node::getTreeNode (  )  const [inline, protected, inherited]

Get the underlying tree node.

DOMTree::Node* DOM::Node::getTreeNode (  )  [inline, protected, inherited]

Get the underlying tree node.

bool DOM::Node::hasAttributes (  )  const throw () [inline, inherited]

Does this node has attribute ?

Returns:
true if this node is an Element with attributes

bool DOM::Node::hasChildNodes (  )  const throw () [inline, inherited]

Does this node has children ?

Returns:
true if this node is parent

const DOMImplementation* const DOM::Document::implementation (  )  const throw () [inline]

Get the current DOM implementation interface.

Returns:
a constant pointer on a constant DOMImplemantation matching this document

const Node * DOM::Document::importNode ( const Node importedNode,
bool  deep 
)

Import a foreign node in this document and clone it.

The cloned node has no parent (it is a root node)

Parameters:
importedNode is the node to import
deep does the cloning is deep ?
Returns:
the cloned node pointer or 0 if failed
Exceptions:
Exceptions::NotSupported if the node cannot be cloned or imported

const Node* DOM::Node::insertBefore ( const Node newNode,
const Node refNode 
) [inline, inherited]

Insert a node before the given node.

Parameters:
newNode the new node pointer to insert before refNode
refNode the reference node to find. If refNode is 0, the newNode is appended, otherwise it Exception::NotFound is thrown
Returns:
the Node being inserted
Exceptions:
Exceptions::NotFound if the given node is not found

static bool DOM::Node::isSupported ( const DOMString feature,
const DOMString version 
) [inline, static, inherited]

Tell if the given features is supported.

Parameters:
feature the feature name
version the version number ("1.0", "2.0" etc...)
Returns:
true if the given feature is supported with the given version

const Node* DOM::Node::lastChild (  )  const [inline, inherited]

Get the last child pointer.

Returns:
the last child Node pointer or 0 if no child is available

virtual DOMString DOM::Node::localName (  )  const [inline, virtual, inherited]

Get the local name.

Todo:
implement this once I understand what it means for HTML

virtual DOMString DOM::Node::namespaceURI (  )  const [inline, virtual, inherited]

Get the namespace URI (if specified).

Todo:
implement this once I understand what it means for HTML

const Node* DOM::Node::nextSibling (  )  const [inline, inherited]

Get the next node in the same current child level.

Returns:
0 if no next Node are linked to us, or the next Node pointer else

virtual DOMString DOM::Document::nodeName (  )  const [inline, virtual]

Get the node name.

Returns:
the node name if known or "Unknown" else

Reimplemented from DOM::Node.

virtual void DOM::Node::nodeValue ( const DOMString newValue  )  [inline, virtual, inherited]

Set the node value.

Exceptions:
Exceptions::NoModificationAllowed exception if not supported

Reimplemented in DOM::CharacterData, and DOM::Attr.

virtual DOMString DOM::Node::nodeValue (  )  const [inline, virtual, inherited]

Get the node value.

Returns:
the node value if known or empty string else

Reimplemented in DOM::CharacterData, and DOM::Attr.

void DOM::Node::normalize (  )  throw () [inline, inherited]

Normalize this tree so that the tree will never have 2 adjacent Text child, or an empty Text child This is used to the tree structure is kept as minimal (normalized).

Todo:
Perform this structure check here, the parser should never create such strange documents anyway

const DOM::Document* DOM::Node::ownerDocument (  )  const [inline, inherited]

Get the owner document.

Returns:
0 if no owner is set, or a pointer on the Document instance

const Node* DOM::Node::parentNode (  )  const [inline, inherited]

Get the parent node.

Returns:
0 if no parent are set for this node

void DOM::Node::prefix ( const DOMString  )  const [inline, inherited]

Set the prefix.

Exceptions:
Exceptions::NoModificationAllowed exception if not supported

virtual DOMString DOM::Node::prefix (  )  const [inline, virtual, inherited]

Get the prefix.

Todo:
implement this once I understand what it means for HTML

const Node* DOM::Node::previousSibling (  )  const [inline, inherited]

Get the previous node in the same current child level.

Returns:
0 if no previous Node are linked to us, or the previous Node pointer else

const Node* DOM::Node::removeChild ( const Node oldNode  )  [inline, inherited]

Remove a child.

Parameters:
oldNode the old node to remove
Exceptions:
Exceptions::NotFound if the oldNode can't be found in the child list
Returns:
the old Node being removed

const Node* DOM::Node::replaceChild ( const Node newNode,
const Node oldNode 
) [inline, inherited]

Replace a child node by another node.

Parameters:
newNode the new node pointer to replace oldNode with (if newNode is already in the child list, it is removed first)
oldNode the old node to remove
Exceptions:
Exceptions::NotFound if the oldNode can't be found in the child list
Returns:
the old Node being replaced

void DOM::Document::returnToAllocator ( const volatile HTML::Elements::Allocators::BaseAllocator allocator  )  [virtual]

Return this node to the allocator.

Parameters:
allocator The allocator to return this node to

Reimplemented from DOM::Node.

bool DOM::Document::setHTMLElement ( const Element htmlElement  )  [inline]

Set the main element if not done already.

Parameters:
htmlElement the new element (must be HTML element) pointer
Returns:
true on success

void DOM::Node::setTreeNode ( DOMTree::Node newTreeNode  )  const [inline, inherited]

Set the reference correctly.

void DOM::Node::Suicide (  )  [inline, inherited]

Make this node commit suicide itself.

Warning:
After calling this method, the pointer you might have on the node is invalidated.

Only call this method for unreachable nodes (like duplicate attribute, and removed or replaced child, and so on)...


Member Data Documentation

const NodeType::Type DOM::Node::nodeType [inherited]

The node type.


The documentation for this class was generated from the following files:

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is