CMDXMLElement Class Reference

class CMDXMLElement : public CMDXMLNode

Generic XML element, and base class for particular XML element types.

It provides access to the element tag name and its attribute list. Attributes are stored as name-value pairs.

Inherits from

Public Member Functions
~CMDXMLElement ()
IMPORT_C TInt AttributeDetails ( TInt , TPtrC &, TPtrC &)
IMPORT_C TBool CheckChildren ()
IMPORT_C TInt FindIndex (const TDesC &)
IMPORT_C CMDXMLElement * FirstChildOfType (const TDesC &)
IMPORT_C TInt GetAttribute (const TDesC &, TPtrC &)
IMPORT_C TBool IsAttributeSpecified (const TDesC &)
IMPORT_C CMDXMLElement * LastChildOfType (const TDesC &)
IMPORT_C CMDXMLElement * NewL ( TBool , CMDXMLDocument *, TPtrC )
IMPORT_C CMDXMLElement * NewLC ( TBool , CMDXMLDocument *, TPtrC )
IMPORT_C TInt NumAttributes ()
IMPORT_C TInt RemoveAttribute (const TDesC &)
IMPORT_C TInt SetAttributeL (const TDesC &, const TDesC &)
IMPORT_C TInt SetAttributeL (const TDesC &, const TDesC &, TBool )
Protected Member Functions
CMDXMLElement ( TBool , CMDXMLDocument *)
IMPORT_C TBool CheckImmediateChildren ()
void ConstructL ()
Private Member Functions
TBool DoCheckImmediateChildrenL ()
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()
CMDXMLNode::AppendChild(CMDXMLNode *)
CMDXMLNode::CMDXMLNode(TDOMNodeType,TBool,CMDXMLDocument *)
CMDXMLNode::CanHaveChildNodes()
CMDXMLNode::ElementType()
CMDXMLNode::FirstChild()
CMDXMLNode::HasChildNodes()
CMDXMLNode::InsertBefore(CMDXMLNode *,CMDXMLNode *)
CMDXMLNode::LastChild()
CMDXMLNode::NextSameTypeSibling()
CMDXMLNode::NextSibling()
CMDXMLNode::NodeName()
CMDXMLNode::NodeType()
CMDXMLNode::OwnerDocument()
CMDXMLNode::ParentNode()
CMDXMLNode::PreviousSameTypeSibling()
CMDXMLNode::PreviousSibling()
CMDXMLNode::RemoveChild(CMDXMLNode *)
CMDXMLNode::ReplaceChild(CMDXMLNode *,CMDXMLNode *)
CMDXMLNode::SetElementType(TInt)
CMDXMLNode::SetNodeNameL(const TDesC &)
CMDXMLNode::~CMDXMLNode()
Inherited Enumerations
CMDXMLNode:TDOMNodeType
Protected Attributes
CDesCArraySeg * iDescAttName
CDesCArraySeg * iDescAttValue
Inherited Attributes
CMDXMLNode::iOwnerDocument

Constructor & Destructor Documentation

CMDXMLElement(TBool, CMDXMLDocument *)

IMPORT_C CMDXMLElement ( TBool aCanHaveChildren,
CMDXMLDocument * aOwnerDocument
) [protected]

Constructor

Parameters

TBool aCanHaveChildren Flag to indicate if the node represents a node which is allowed children
CMDXMLDocument * aOwnerDocument Pointer to the document at the root of the DOM tree - if NULL then assume this is the root

~CMDXMLElement()

IMPORT_C ~CMDXMLElement ( ) [virtual]

Destructor.

Member Functions Documentation

AttributeDetails(TInt, TPtrC &, TPtrC &)

IMPORT_C TInt AttributeDetails ( TInt Index,
TPtrC & aAttributeName,
TPtrC & aAttributeValue
)

Gets the name and value of an attribute at a given index.

Parameters

TInt Index The array index of the element for which details are required
TPtrC & aAttributeName The attribute name returned
TPtrC & aAttributeValue The attribute value returned

CheckChildren()

IMPORT_C TBool CheckChildren ( ) [virtual]

Checks the children of this node for validity.

It checks that the list of child elements conforms to those allowed by the DTD.

In a generic CMDXMLElement object, this is always true as it has no basis for a meaningful check. As well as checking the list of direct children, it calls CheckChildren() for each child element. It does not check child nodes that are not elements, as they cannot have children.

CheckImmediateChildren()

IMPORT_C TBool CheckImmediateChildren ( ) [protected, virtual]

Check the immediate children of this element - i.e. the first level of children only The default implementation returns true - derived classes can override with DTD-specific checks.

ConstructL()

void ConstructL ( ) [protected]

DoCheckImmediateChildrenL()

TBool DoCheckImmediateChildrenL ( ) [private]

FindIndex(const TDesC &)

IMPORT_C TInt FindIndex ( const TDesC & aAttName )

Finds an attribute and returns the index of it.

Parameters

const TDesC & aAttName The attribute to search for

FirstChildOfType(const TDesC &)

IMPORT_C CMDXMLElement * FirstChildOfType ( const TDesC & aElementType )

Gets a pointer to the first child of a given type if any, otherwise returns NULL.

Parameters

const TDesC & aElementType Name of element type to return

GetAttribute(const TDesC &, TPtrC &)

IMPORT_C TInt GetAttribute ( const TDesC & aAttributeName,
TPtrC & aAttributeValue
) const [virtual]

Gets a specified attribute value.

Parameters

const TDesC & aAttributeName Name of the attribute to get
TPtrC & aAttributeValue On return, the value of the attribute

IsAttributeSpecified(const TDesC &)

IMPORT_C TBool IsAttributeSpecified ( const TDesC & aAttributeName ) const [virtual]

Tests if a specified attribute is set.

Parameters

const TDesC & aAttributeName Name of the attribute to test

LastChildOfType(const TDesC &)

IMPORT_C CMDXMLElement * LastChildOfType ( const TDesC & aElementType )

Gets a pointer to the last child of a given type if any, otherwise returns NULL.

Parameters

const TDesC & aElementType Name of element type to return

NewL(TBool, CMDXMLDocument *, TPtrC)

IMPORT_C CMDXMLElement * NewL ( TBool aCanHaveChildren,
CMDXMLDocument * aOwnerDocument,
TPtrC aTagName
) [static]

Allocates and constructs a new CMDXMLElement .

leave
KErrNoMemory Out of memory

Parameters

TBool aCanHaveChildren Set to true if the element can have children
CMDXMLDocument * aOwnerDocument Pointer to the document at the root of the DOM tree
TPtrC aTagName Name of the tag for the element

NewLC(TBool, CMDXMLDocument *, TPtrC)

IMPORT_C CMDXMLElement * NewLC ( TBool aCanHaveChildren,
CMDXMLDocument * aOwnerDocument,
TPtrC aTagName
) [static]

Allocates and constructs a new CMDXMLElement , leaving the object on the cleanup stack.

leave
KErrNoMemory Out of memory

Parameters

TBool aCanHaveChildren Set to true if the element can have children
CMDXMLDocument * aOwnerDocument Pointer to the document at the root of the DOM tree
TPtrC aTagName Name of the tag for the element

NumAttributes()

IMPORT_C TInt NumAttributes ( )

Gets the number of attributes that this element has.

RemoveAttribute(const TDesC &)

IMPORT_C TInt RemoveAttribute ( const TDesC & aAttributeName ) [virtual]

Removes a specified attribute.

Parameters

const TDesC & aAttributeName Name of the attribute to remove

SetAttributeL(const TDesC &, const TDesC &)

IMPORT_C TInt SetAttributeL ( const TDesC & aAttributeName,
const TDesC & aAttributeValue
) [virtual]

Checks the validity of an attribute and adds it to the DOM if it's valid.

leave
KErrNoMemory Out of memory

Parameters

const TDesC & aAttributeName Name of the attribute to set
const TDesC & aAttributeValue Value of the attribute

SetAttributeL(const TDesC &, const TDesC &, TBool)

IMPORT_C TInt SetAttributeL ( const TDesC & aAttributeName,
const TDesC & aAttributeValue,
TBool aStoreInvalid
)
Checks the validity of an attribute and adds it to the DOM. The aStoreInvalid parameter is used to control whether invalid attributes are added to the DOM.
leave
KErrNoMemory Out of memory

Parameters

const TDesC & aAttributeName Name of the attribute to set
const TDesC & aAttributeValue Value of the attribute
TBool aStoreInvalid If set to EFalse only attributes that are found to be valid will be added to the DOM. Set to ETrue to store all attributes in the DOM, even those that are invalid.

Member Data Documentation

CDesCArraySeg * iDescAttName

CDesCArraySeg * iDescAttName [protected]

Store attribute names

CDesCArraySeg * iDescAttValue

CDesCArraySeg * iDescAttValue [protected]

Store attribute values