MSenElement Class Reference

class MSenElement
The abstract interface of an XML element SenXML.dll
Since
Series60 3.0
Public Member Functions
voidAddAttrL(const TDesC8 &, const TDesC8 &)
voidAddAttributesL(const RAttributeArray &)
CSenElement &AddElementL(CSenElement &)
CSenElement &AddElementL(const TDesC8 &, const TDesC8 &)
CSenElement &AddElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &)
CSenElement &AddElementL(const TDesC8 &)
const CSenNamespace *AddNamespaceL(const TDesC8 &, const TDesC8 &)
const CSenNamespace *AddNamespaceL(CSenNamespace &, TBool)
MSenElement *AsElement()
HBufC8 *AsXmlL()
HBufC *AsXmlUnicodeL()
const TDesC8 *AttrValue(const TDesC8 &)
RPointerArray< CSenBaseAttribute > &AttributesL()
CSenElement *Child(TInt)
TBool ConsistsOfL(MSenElement &)
TPtrC8 Content()
HBufC *ContentUnicodeL()
RWriteStream &ContentWriteStreamL()
voidCopyFromL(CSenElement &)
CSenElement *CreateElementL(const TDesC8 &, const TDesC8 &)
CSenElement *DetachL()
CSenElement *Element(const TDesC8 &)
CSenElement *Element(const TDesC8 &, const TDesC8 &)
RPointerArray< CSenElement > &ElementsL()
TBool HasContent()
CSenElement &InsertElementL(CSenElement &, const CSenElement &)
const TDesC8 &LocalName()
const CSenNamespace *Namespace()
const CSenNamespace *Namespace(const TDesC8 &)
const CSenNamespace *Namespace(const TDesC8 &, const TDesC8 &)
const CSenNamespace *Namespace(const TDesC8 &, const TBool)
const TDesC8 &NamespaceURI()
RPointerArray< CSenNamespace > &NamespacesL()
const TDesC8 &NsPrefix()
CSenElement *Parent()
CSenElement *RemoveElement(CSenElement &)
CSenElement *RemoveElement(const TDesC8 &, const TDesC8 &)
CSenElement *RemoveElement(const TDesC8 &)
CSenElement *ReplaceElementL(CSenElement &)
MSenElement &Root()
voidSet(const TDesC8 &, const TDesC8 &, const TDesC8 &)
TPtrC8 SetContentL(const TDesC8 &)
voidSetNamespaceL(const TDesC8 &)
voidSetNamespaceL(const TDesC8 &, const TDesC8 &)
CSenElement *SetParent(CSenElement *)
voidSetPrefixL(const TDesC8 &)
voidWriteAsXMLToL(RWriteStream &)
voidWriteNamespacesToL(RWriteStream &)

Member Functions Documentation

AddAttrL(const TDesC8 &, const TDesC8 &)

voidAddAttrL(const TDesC8 &aName,
const TDesC8 &aValue
)[pure virtual]

Adds an attribute. If attribute is already existing, the value of the attribute will be replaced.

Parameters

const TDesC8 & aNameName of the attribute to be added.
const TDesC8 & aValueValue of the attribute to be added.

AddAttributesL(const RAttributeArray &)

voidAddAttributesL(const RAttributeArray &aAttrs)[pure virtual]

Adds new attributes to the element.

Parameters

const RAttributeArray & aAttrs

AddElementL(CSenElement &)

CSenElement &AddElementL(CSenElement &aElement)[pure virtual]

Adds an Element to the children elements. Sets this element to be the new parent of the given element.

Parameters

CSenElement & aElement

AddElementL(const TDesC8 &, const TDesC8 &)

CSenElement &AddElementL(const TDesC8 &aNsUri,
const TDesC8 &aLocalName
)[pure virtual]

Constructs and adds a new element to the children elements. Sets this element to be the new parent of the given element.

Parameters

const TDesC8 & aNsUri
const TDesC8 & aLocalName

AddElementL(const TDesC8 &, const TDesC8 &, const TDesC8 &)

CSenElement &AddElementL(const TDesC8 &aNsUri,
const TDesC8 &aLocalName,
const TDesC8 &aQName
)[pure virtual]

Constructs and adds a new element to the children elements. Sets this element to be the new parent of the given element.

Parameters

const TDesC8 & aNsUri
const TDesC8 & aLocalName
const TDesC8 & aQName

AddElementL(const TDesC8 &)

CSenElement &AddElementL(const TDesC8 &aLocalName)[pure virtual]

Constructs and adds a new element to the children elements. Sets this element to be the new parent of the given element. Note: Element is created with no specific namespace, default namespace of some of the upper level elements are in effect if there is such a namespace.

Parameters

const TDesC8 & aLocalName

AddNamespaceL(const TDesC8 &, const TDesC8 &)

const CSenNamespace *AddNamespaceL(const TDesC8 &aPrefix,
const TDesC8 &aUri
)[pure virtual]

Method for adding a namespace for the Element.

Parameters

const TDesC8 & aPrefix
const TDesC8 & aUri

AddNamespaceL(CSenNamespace &, TBool)

const CSenNamespace *AddNamespaceL(CSenNamespace &aNewNamespace,
TBoolaCheckInParent
)[pure virtual]

Adds a namespace declaration. If this element (or its parent if parameter aCheckInParent is ETrue) already has a Namespace with the same prefix and URI the given Namespace is not added.

Parameters

CSenNamespace & aNewNamespace
TBool aCheckInParent

AsElement()

MSenElement *AsElement()[pure virtual]

Gets the current element as XML element. Mostly used to get the classes which implement this interface as an instance of this interface.

AsXmlL()

HBufC8 *AsXmlL()[pure virtual]

Gets element as an UTF-8 form XML.

AsXmlUnicodeL()

HBufC *AsXmlUnicodeL()[pure virtual]
Gets the element as XML fragment in Unicode UCS2 format.
Since
Series60 3.0

AttrValue(const TDesC8 &)

const TDesC8 *AttrValue(const TDesC8 &aName)[pure virtual]

Gets the value of the given attribute.

Parameters

const TDesC8 & aName

AttributesL()

RPointerArray< CSenBaseAttribute > &AttributesL()[pure virtual]

Gets all the attributes of this element in an array.

Child(TInt)

CSenElement *Child(TIntaIndex)[pure virtual]

Gets a child element from a specified index.

Parameters

TInt aIndex

ConsistsOfL(MSenElement &)

TBool ConsistsOfL(MSenElement &aCandidate)[pure virtual]
Checks if element matches to another element by its content and child elements. Element can contain more data than the given pattern.
Since
Series60 3.0

Parameters

MSenElement & aCandidateThe pattern to be matched. Must contain same or less data for match to come true.

Content()

TPtrC8 Content()const [pure virtual]

Getter for the content of the element.

ContentUnicodeL()

HBufC *ContentUnicodeL()const [pure virtual]

Getter for the content of the element, unicode version.

ContentWriteStreamL()

RWriteStream &ContentWriteStreamL()[pure virtual]

Gets the write stream for the content for easy appending. Writing 8-bit (UTF-8) string to the returned stream will be appended to the content.

CopyFromL(CSenElement &)

voidCopyFromL(CSenElement &aSource)[pure virtual]

Copies content from given element to this element appending to the existing content if there is any.

Parameters

CSenElement & aSource

CreateElementL(const TDesC8 &, const TDesC8 &)

CSenElement *CreateElementL(const TDesC8 &aNsPrefix,
const TDesC8 &aLocalName
)[pure virtual]

Create a new element ready for adding or insertion. If the given namespace prefix is not declared yet the element will not be created and NULL will be returned.

Parameters

const TDesC8 & aNsPrefix
const TDesC8 & aLocalName

DetachL()

CSenElement *DetachL()[pure virtual]

Detach the element from its parent. If the element, or one of its children, is dependent on a namespace declared in the scope of the parent copy those namespace declarations to this element.

Element(const TDesC8 &)

CSenElement *Element(const TDesC8 &aLocalName)[pure virtual]

Gets the child element with the specified local name. Assumes that namespace is the same as this parent element.

Parameters

const TDesC8 & aLocalName

Element(const TDesC8 &, const TDesC8 &)

CSenElement *Element(const TDesC8 &aNsUri,
const TDesC8 &aLocalName
)[pure virtual]

Gets the child element with the specified local name and namespace URI.

Parameters

const TDesC8 & aNsUri
const TDesC8 & aLocalName

ElementsL()

RPointerArray< CSenElement > &ElementsL()[pure virtual]

Getting the child elements of this element.

HasContent()

TBool HasContent()const [pure virtual]

Method for checking if the element has any content within.

InsertElementL(CSenElement &, const CSenElement &)

CSenElement &InsertElementL(CSenElement &aInsertedElement,
const CSenElement &aBeforeElement
)[pure virtual]

Insert an Element into the list of children elements so that the inserted Element is placed right before the aBeforeElement. If aBeforeElement is not found, element will be appended to the last position. Function leaves if error occurs in inserting.

Parameters

CSenElement & aInsertedElement
const CSenElement & aBeforeElement

LocalName()

const TDesC8 &LocalName()const [pure virtual]

Getter for Element's local name.

Namespace()

const CSenNamespace *Namespace()[pure virtual]

Getter for Element's namespace.

Namespace(const TDesC8 &)

const CSenNamespace *Namespace(const TDesC8 &aNsPrefix)[pure virtual]

Get namespace that is declared for the given prefix

Parameters

const TDesC8 & aNsPrefix

Namespace(const TDesC8 &, const TDesC8 &)

const CSenNamespace *Namespace(const TDesC8 &aNsPrefix,
const TDesC8 &aUri
)[pure virtual]

Get namespace that is declared for the given prefix and namespace URI within the scope of this Element.

Parameters

const TDesC8 & aNsPrefix
const TDesC8 & aUri

Namespace(const TDesC8 &, const TBool)

const CSenNamespace *Namespace(const TDesC8 &aNsPrefix,
const TBoolaCheckInParent
)[pure virtual]

Get namespace that is declared for the given prefix and namespace URI within the scope of this Element.

Parameters

const TDesC8 & aNsPrefix
const TBool aCheckInParent

NamespaceURI()

const TDesC8 &NamespaceURI()const [pure virtual]

Getter for Element's namespace URI.

NamespacesL()

RPointerArray< CSenNamespace > &NamespacesL()[pure virtual]

Gets all the namespaces of this element in an array.

NsPrefix()

const TDesC8 &NsPrefix()const [pure virtual]

Getter for namespace prefix of this element.

Parent()

CSenElement *Parent()[pure virtual]

Gets the parent element of this element.

RemoveElement(CSenElement &)

CSenElement *RemoveElement(CSenElement &aElement)[pure virtual]

Remove an element from the childs.

Parameters

CSenElement & aElement

RemoveElement(const TDesC8 &, const TDesC8 &)

CSenElement *RemoveElement(const TDesC8 &aNsUri,
const TDesC8 &aLocalName
)[pure virtual]

Remove an element from the childs.

Parameters

const TDesC8 & aNsUri
const TDesC8 & aLocalName

RemoveElement(const TDesC8 &)

CSenElement *RemoveElement(const TDesC8 &aLocalName)[pure virtual]

Remove an element from the childs.

Parameters

const TDesC8 & aLocalName

ReplaceElementL(CSenElement &)

CSenElement *ReplaceElementL(CSenElement &aElement)[pure virtual]

Replaces an element from the childs with another element. Element's local name and namespace URI will be used to match the element to be replaced. If matching element is not found, will normally add the given element to the childs.

Parameters

CSenElement & aElement

Root()

MSenElement &Root()[pure virtual]

Gets the root element. If no parent element, returns this element.

Set(const TDesC8 &, const TDesC8 &, const TDesC8 &)

voidSet(const TDesC8 &aNamespaceURI,
const TDesC8 &aLocalName,
const TDesC8 &aQName
)[pure virtual]

(Re-) Set the name and namespace of this Element. The element will be given the localName in the the given namespace. A prefix will be computed from the qualified name.

This method should be used with care and is mainly intended for protected use in implementations.

Parameters

const TDesC8 & aNamespaceURI
const TDesC8 & aLocalName
const TDesC8 & aQName

SetContentL(const TDesC8 &)

TPtrC8 SetContentL(const TDesC8 &aContent)[pure virtual]

Sets the content to the element. Old content is overwritten.

Parameters

const TDesC8 & aContent

SetNamespaceL(const TDesC8 &)

voidSetNamespaceL(const TDesC8 &aNsUri)[pure virtual]

Setter for Element's namespace URI.

Parameters

const TDesC8 & aNsUri

SetNamespaceL(const TDesC8 &, const TDesC8 &)

voidSetNamespaceL(const TDesC8 &aNsPrefix,
const TDesC8 &aNsUri
)[pure virtual]

Setter for Element's namespace URI.

Parameters

const TDesC8 & aNsPrefix
const TDesC8 & aNsUri

SetParent(CSenElement *)

CSenElement *SetParent(CSenElement *apParent)[pure virtual]

Sets the parent element to this element. Notice that the element is not automatically added as a child of the parent. Parent's AddElementL() should be called instead.

Parameters

CSenElement * apParent

SetPrefixL(const TDesC8 &)

voidSetPrefixL(const TDesC8 &aPrefix)[pure virtual]

Setter for namespace prefix of this element.

Parameters

const TDesC8 & aPrefix

WriteAsXMLToL(RWriteStream &)

voidWriteAsXMLToL(RWriteStream &aWriteStream)[pure virtual]
Writes this element as XML, in UTF-8 form to a stream
Since
Series60 3.0

Parameters

RWriteStream & aWriteStreamto write into.

WriteNamespacesToL(RWriteStream &)

voidWriteNamespacesToL(RWriteStream &aWriteStream)[pure virtual]

Element writes its namespaces to a write stream using UTF-8 charset encoding.

Parameters

RWriteStream & aWriteStream