MSenElement Class Reference

#include <mw/MSenElement.h>

Link against: SenXML.dll

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

Detailed Description

The abstract interface of an XML element
Since
Series60 3.0

Member Function 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.

ParameterDescription
aNameName of the attribute to be added.
aValueValue of the attribute to be added.

AddAttributesL ( const RAttributeArray & )

voidAddAttributesL(const RAttributeArray &aAttrs)[pure virtual]

Adds new attributes to the element.

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.

Returns: the added Element

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.

Returns: the added Element Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

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.

Returns: the added Element Leave codes: KErrSenInvalidCharacters if aLocalName or aQName contain illegal characters. KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.

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.

Returns: the added Element Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

AddNamespaceL ( const TDesC8 &, const TDesC8 & )

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

Method for adding a namespace for the Element.

Returns: the added Namespace, or the equivalent pre-existing one.

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.

Returns: the added Namespace, or the equivalent pre-existing one.

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.

Returns: the current object as element. Ownership is NOT transferred.

AsXmlL ( )

HBufC8 *AsXmlL()[pure virtual]

Gets element as an UTF-8 form XML.

Returns: element as XML (in UTF-8 format). Caller takes ownership.

AsXmlUnicodeL ( )

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

Returns: the service description as XML, which ownership is transferred to the caller.

AttrValue ( const TDesC8 & )

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

Gets the value of the given attribute.

Returns: the value of the attribute, or NULL if not found. Ownership is NOT TRANSFERRED.

AttributesL ( )

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

Gets all the attributes of this element in an array.

Returns: array of attributes. Array will be empty if element has no attributes.

Child ( TInt )

CSenElement *Child(TIntaIndex)[pure virtual]

Gets a child element from a specified index.

Returns: child element from a current index. NULL if no child in given index is found

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
ParameterDescription
aCandidateThe pattern to be matched. Must contain same or less data for match to come true.

Returns: ETrue if content and possible children match exactly to given pattern. EFalse otherwise.

Content ( )

TPtrC8 Content()const [pure virtual]

Getter for the content of the element.

Returns: the content or KNullDesC8 if empty.

ContentUnicodeL ( )

HBufC *ContentUnicodeL()const [pure virtual]

Getter for the content of the element, unicode version.

Returns: content as unicode. Ownership IS TRANSFERRED to the caller.

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.

Returns: reference to the RWriteStream.

CopyFromL ( CSenElement & )

voidCopyFromL(CSenElement &aSource)[pure virtual]

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

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.

Returns: the new Element just created, or NULL if given prefix was not declared yet. Ownership is transferred to the caller. Leave codes: KErrSenInvalidCharacters if aLocalName or aQName contain illegal characters. KErrSenZeroLengthDescriptor if aLocalName is zero length.

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.

Returns: this Element. Ownership is NOT transferred to the caller. Returns NULL if no parent was set, and nothing was detached.

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.

Returns: the child element or NULL if the child with the specified local name is not found. Ownership is NOT transferred.

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.

Returns: the child element or NULL if the child with the specified criterias is not found. Ownership is NOT transferred.

ElementsL ( )

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

Getting the child elements of this element.

Returns: an array of child elements. This is an empty array if there are no children. Any modifications made on the returned array modify the element object.

HasContent ( )

TBool HasContent()const [pure virtual]

Method for checking if the element has any content within.

Returns: ETrue if has content, EFalse if not.

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.

Returns: the inserted Element

LocalName ( )

const TDesC8 &LocalName()const [pure virtual]

Getter for Element's local name.

Returns: KNullDesC if not set

Namespace ( )

const CSenNamespace *Namespace()[pure virtual]

Getter for Element's namespace.

Returns: const pointer to the CSenNamespace object of this Element. NULL if not set.

Namespace ( const TDesC8 & )

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

Get namespace that is declared for the given prefix

Returns: the found Namespace that is declared for the given prefix within the scope of this Element or NULL if not found.

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.

Returns: the found Namespace that is declared for the given prefix and namespace URI within the scope of this Element or NULL if not found.

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.

Returns: the found Namespace that is declared for the given prefix and namespace URI within the scope of this Element or NULL if not found

NamespaceURI ( )

const TDesC8 &NamespaceURI()const [pure virtual]

Getter for Element's namespace URI.

Returns: Namespace URI or KNullDesC if not set.

NamespacesL ( )

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

Gets all the namespaces of this element in an array.

Returns: array of namespaces. Array will be empty if element has no namespaces.

NsPrefix ( )

const TDesC8 &NsPrefix()const [pure virtual]

Getter for namespace prefix of this element.

Returns: namespace prefix or KNullDesC8 if not set.

Parent ( )

CSenElement *Parent()[pure virtual]

Gets the parent element of this element.

Returns: the parent element or NULL if no parent set. Ownership is NOT transferred to the caller.

RemoveElement ( CSenElement & )

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

Remove an element from the childs.

Returns: The removed element. May be NULL if nothing was removed (if element was not found from the childs). The caller TAKES OWNERSHIP of the removed element.

RemoveElement ( const TDesC8 &, const TDesC8 & )

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

Remove an element from the childs.

Returns: The removed element. May be NULL if nothing was removed (if element was not found from the childs). The caller TAKES OWNERSHIP of the removed element.

RemoveElement ( const TDesC8 & )

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

Remove an element from the childs.

Returns: The removed element. May be NULL if nothing was removed (if element was not found from the childs). The caller TAKES OWNERSHIP of the removed element.

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.

Returns: The old element. May be NULL if nothing was replaced (if element was not found from the childs). The caller TAKES OWNERSHIP of the old element.

Root ( )

MSenElement &Root()[pure virtual]

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

Returns: the root of the tree. Ownership is not transferred.

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.

SetContentL ( const TDesC8 & )

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

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

Returns: The content of the element or KNullDesC8 if no content was set.

SetNamespaceL ( const TDesC8 & )

voidSetNamespaceL(const TDesC8 &aNsUri)[pure virtual]

Setter for Element's namespace URI.

SetNamespaceL ( const TDesC8 &, const TDesC8 & )

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

Setter for Element's namespace URI.

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.

Returns: the parent element

SetPrefixL ( const TDesC8 & )

voidSetPrefixL(const TDesC8 &aPrefix)[pure virtual]

Setter for namespace prefix of this element.

WriteAsXMLToL ( RWriteStream & )

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

WriteNamespacesToL ( RWriteStream & )

voidWriteNamespacesToL(RWriteStream &aWriteStream)[pure virtual]

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