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 TIntAttributeDetails(TInt, TPtrC &, TPtrC &)
IMPORT_C TBoolCheckChildren()
IMPORT_C TIntFindIndex(const TDesC &)
IMPORT_C CMDXMLElement *FirstChildOfType(const TDesC &)
IMPORT_C TIntGetAttribute(const TDesC &, TPtrC &)
IMPORT_C TBoolIsAttributeSpecified(const TDesC &)
IMPORT_C CMDXMLElement *LastChildOfType(const TDesC &)
IMPORT_C CMDXMLElement *NewL(TBool, CMDXMLDocument *, TPtrC)
IMPORT_C CMDXMLElement *NewLC(TBool, CMDXMLDocument *, TPtrC)
IMPORT_C TIntNumAttributes()
IMPORT_C TIntRemoveAttribute(const TDesC &)
IMPORT_C TIntSetAttributeL(const TDesC &, const TDesC &)
IMPORT_C TIntSetAttributeL(const TDesC &, const TDesC &, TBool)
Protected Member Functions
CMDXMLElement(TBool, CMDXMLDocument *)
IMPORT_C TBoolCheckImmediateChildren()
voidConstructL()
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_CCMDXMLElement(TBoolaCanHaveChildren,
CMDXMLDocument *aOwnerDocument
)[protected]

Constructor

Parameters

TBool aCanHaveChildrenFlag to indicate if the node represents a node which is allowed children
CMDXMLDocument * aOwnerDocumentPointer 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 TIntAttributeDetails(TIntIndex,
TPtrC &aAttributeName,
TPtrC &aAttributeValue
)

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

Parameters

TInt IndexThe array index of the element for which details are required
TPtrC & aAttributeNameThe attribute name returned
TPtrC & aAttributeValueThe attribute value returned

CheckChildren()

IMPORT_C TBoolCheckChildren()[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 TBoolCheckImmediateChildren()[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()

voidConstructL()[protected]

DoCheckImmediateChildrenL()

TBool DoCheckImmediateChildrenL()[private]

FindIndex(const TDesC &)

IMPORT_C TIntFindIndex(const TDesC &aAttName)

Finds an attribute and returns the index of it.

Parameters

const TDesC & aAttNameThe 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 & aElementTypeName of element type to return

GetAttribute(const TDesC &, TPtrC &)

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

Gets a specified attribute value.

Parameters

const TDesC & aAttributeNameName of the attribute to get
TPtrC & aAttributeValueOn return, the value of the attribute

IsAttributeSpecified(const TDesC &)

IMPORT_C TBoolIsAttributeSpecified(const TDesC &aAttributeName)const [virtual]

Tests if a specified attribute is set.

Parameters

const TDesC & aAttributeNameName 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 & aElementTypeName of element type to return

NewL(TBool, CMDXMLDocument *, TPtrC)

IMPORT_C CMDXMLElement *NewL(TBoolaCanHaveChildren,
CMDXMLDocument *aOwnerDocument,
TPtrCaTagName
)[static]

Allocates and constructs a new CMDXMLElement.

leave
KErrNoMemory Out of memory

Parameters

TBool aCanHaveChildrenSet to true if the element can have children
CMDXMLDocument * aOwnerDocumentPointer to the document at the root of the DOM tree
TPtrC aTagNameName of the tag for the element

NewLC(TBool, CMDXMLDocument *, TPtrC)

IMPORT_C CMDXMLElement *NewLC(TBoolaCanHaveChildren,
CMDXMLDocument *aOwnerDocument,
TPtrCaTagName
)[static]

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

leave
KErrNoMemory Out of memory

Parameters

TBool aCanHaveChildrenSet to true if the element can have children
CMDXMLDocument * aOwnerDocumentPointer to the document at the root of the DOM tree
TPtrC aTagNameName of the tag for the element

NumAttributes()

IMPORT_C TIntNumAttributes()

Gets the number of attributes that this element has.

RemoveAttribute(const TDesC &)

IMPORT_C TIntRemoveAttribute(const TDesC &aAttributeName)[virtual]

Removes a specified attribute.

Parameters

const TDesC & aAttributeNameName of the attribute to remove

SetAttributeL(const TDesC &, const TDesC &)

IMPORT_C TIntSetAttributeL(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 & aAttributeNameName of the attribute to set
const TDesC & aAttributeValueValue of the attribute

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

IMPORT_C TIntSetAttributeL(const TDesC &aAttributeName,
const TDesC &aAttributeValue,
TBoolaStoreInvalid
)
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 & aAttributeNameName of the attribute to set
const TDesC & aAttributeValueValue of the attribute
TBool aStoreInvalidIf 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