CMDXMLNode Class Reference

class CMDXMLNode : public CBase

Abstract base class for DOM node classes.

It stores the node type and name, and manages a list of child nodes. The node name and type are set in the derived class's constructor and cannot be changed.

The list of child nodes is managed as a doubly-linked list, not an array or similar structure.

Derived classes that are not allowed children override the operations to manipulate the child list.

Inherits from

Public Member Functions
~CMDXMLNode ()
IMPORT_C TInt AppendChild ( CMDXMLNode *)
TBool CanHaveChildNodes ()
IMPORT_C TBool CheckChildren ()
TInt ElementType ()
CMDXMLNode * FirstChild ()
TBool HasChildNodes ()
IMPORT_C TInt InsertBefore ( CMDXMLNode *, CMDXMLNode *)
CMDXMLNode * LastChild ()
CMDXMLNode * NextSibling ()
IMPORT_C TPtrC NodeName ()
TDOMNodeType NodeType ()
CMDXMLDocument * OwnerDocument ()
CMDXMLNode * ParentNode ()
CMDXMLNode * PreviousSibling ()
IMPORT_C TInt RemoveChild ( CMDXMLNode *)
IMPORT_C TInt ReplaceChild ( CMDXMLNode *, CMDXMLNode *)
Protected Member Functions
CMDXMLNode ( TDOMNodeType , TBool , CMDXMLDocument *)
IMPORT_C CMDXMLNode * NextSameTypeSibling ()
IMPORT_C CMDXMLNode * PreviousSameTypeSibling ()
void SetElementType ( TInt )
IMPORT_C void SetNodeNameL (const TDesC &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TDOMNodeType {
EElementNode  = 1, ETextNode  = 3, ECDATASectionNode  = 4, EProcessingInstructionNode  = 7, ECommentNode  = 8, EDocumentNode  = 9
}
Protected Attributes
CMDXMLDocument * iOwnerDocument
Private Attributes
TBool iCanHaveChildren
TInt iElementType
CMDXMLNode * iFirstChildPtr
CMDXMLNode * iLastChildPtr
CMDXMLNode * iNextSiblingPtr
HBufC * iNodeName
TDOMNodeType iNodeType
CMDXMLNode * iParentPtr
CMDXMLNode * iPrevSiblingPtr

Constructor & Destructor Documentation

CMDXMLNode(TDOMNodeType, TBool, CMDXMLDocument *)

CMDXMLNode ( TDOMNodeType aNodeType,
TBool aCanHaveChildren,
CMDXMLDocument * aOwnerDocument
) [protected]

Parameters

TDOMNodeType aNodeType
TBool aCanHaveChildren
CMDXMLDocument * aOwnerDocument

~CMDXMLNode()

IMPORT_C ~CMDXMLNode ( ) [virtual]

Destructor.

When a node is deleted, it:

1. links its previous and next siblings

2. deletes all its children

3. corrects its parents first and last child pointers if necessary

Member Functions Documentation

AppendChild(CMDXMLNode *)

IMPORT_C TInt AppendChild ( CMDXMLNode * aChildToInsert )

Appends a new child at the end of the child list.

Parameters

CMDXMLNode * aChildToInsert Pointer to the new child node to append.

CanHaveChildNodes()

TBool CanHaveChildNodes ( ) [inline]

Tests if the node can have child nodes.

CheckChildren()

IMPORT_C TBool CheckChildren ( ) [pure virtual]

Checks the children of this node for validity.

ElementType()

TInt ElementType ( ) [inline]

Gets the element type as an enumerated value.

This function is quicker to use than NodeName() .

FirstChild()

CMDXMLNode * FirstChild ( ) [inline]

Gets a pointer to the first child node, if any.

HasChildNodes()

TBool HasChildNodes ( ) [inline]

Tests if the node has any child nodes.

InsertBefore(CMDXMLNode *, CMDXMLNode *)

IMPORT_C TInt InsertBefore ( CMDXMLNode * aInsertBeforeChild,
CMDXMLNode * aChildToInsert
)

Inserts a new child node at a specific point in the child list.

Parameters

CMDXMLNode * aInsertBeforeChild Pointer to the element before which the new child should be inserted. UseNULL to insert at the start of the list.
CMDXMLNode * aChildToInsert Pointer to the new child node to insert

LastChild()

CMDXMLNode * LastChild ( ) [inline]

Gets a pointer to the last child node, if any.

NextSameTypeSibling()

IMPORT_C CMDXMLNode * NextSameTypeSibling ( ) [protected]

Gets a pointer to the next sibling node of the same type if any, otherwise returns NULL

NextSibling()

CMDXMLNode * NextSibling ( ) [inline]

Gets a pointer to the next sibling node, if any.

NodeName()

IMPORT_C TPtrC NodeName ( )

Gets the name of the node.

NodeType()

TDOMNodeType NodeType ( ) [inline]

Gets the node type of the node.

OwnerDocument()

CMDXMLDocument * OwnerDocument ( ) [inline]

Gets a pointer to the document which is the owner of the DOM tree.

ParentNode()

CMDXMLNode * ParentNode ( ) [inline]

Gets a pointer to the parent node, if any.

PreviousSameTypeSibling()

IMPORT_C CMDXMLNode * PreviousSameTypeSibling ( ) [protected]

Gets a pointer to the previous sibling node of the same type if any, otherwise returns NULL

PreviousSibling()

CMDXMLNode * PreviousSibling ( ) [inline]

Gets a pointer to the previous sibling node, if any.

RemoveChild(CMDXMLNode *)

IMPORT_C TInt RemoveChild ( CMDXMLNode * aChildToRemove )

Removes a child from the list of child nodes.

The child node is not deleted: that is the responsibility of the caller.

Parameters

CMDXMLNode * aChildToRemove Pointer to child to remove from the list

ReplaceChild(CMDXMLNode *, CMDXMLNode *)

IMPORT_C TInt ReplaceChild ( CMDXMLNode * aChildToInsert,
CMDXMLNode * aChildToReplace
)

Inserts a new child node while removing an existing one.

The old child is not deleted.

Parameters

CMDXMLNode * aChildToInsert Pointer to the new child node to insert
CMDXMLNode * aChildToReplace Pointer to the child node to be replaced

SetElementType(TInt)

void SetElementType ( TInt aElementType ) [protected, inline]

Sets the enumerated element type (same information as node name but faster to access)

Parameters

TInt aElementType

SetNodeNameL(const TDesC &)

IMPORT_C void SetNodeNameL ( const TDesC & aNodeName ) [protected]
Set the node name - normally on creation
leave
Can Leave due to OOM

Parameters

const TDesC & aNodeName The node name - commonly an element tag name - _not_ any unique identifier

Member Enumerations Documentation

Enum TDOMNodeType

XML DOM node types.

The values are taken from the DOM definition, but only some of them are used for the SMIL API.

Enumerators

EElementNode = 1
ETextNode = 3
ECDATASectionNode = 4
EProcessingInstructionNode = 7
ECommentNode = 8
EDocumentNode = 9

Member Data Documentation

TBool iCanHaveChildren

TBool iCanHaveChildren [private]

TInt iElementType

TInt iElementType [private]

CMDXMLNode * iFirstChildPtr

CMDXMLNode * iFirstChildPtr [private]

CMDXMLNode * iLastChildPtr

CMDXMLNode * iLastChildPtr [private]

CMDXMLNode * iNextSiblingPtr

CMDXMLNode * iNextSiblingPtr [private]

HBufC * iNodeName

HBufC * iNodeName [private]

TDOMNodeType iNodeType

TDOMNodeType iNodeType [private]

CMDXMLDocument * iOwnerDocument

CMDXMLDocument * iOwnerDocument [protected]

CMDXMLNode * iParentPtr

CMDXMLNode * iParentPtr [private]

CMDXMLNode * iPrevSiblingPtr

CMDXMLNode * iPrevSiblingPtr [private]