CSenElement Class Reference

#include <mw/SenElement.h>

Link against: SenXML.dll

class CSenElement : public CBase

Inherits from

  • CSenElement
    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 TInt ElementsL(RPointerArray< CSenElement > &, const TDesC8 &, const TDesC8 &)
    pure virtual TInt ElementsL(RPointerArray< CSenElement > &, 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 &)
    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()

    Detailed Description

    Abstract class definition of 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.
    Since
    Series60 3.0
    ParameterDescription
    aNameName of the attribute to be added.
    aValueValue of the attribute to be added.

    AddAttributesL ( const RAttributeArray & )

    voidAddAttributesL(const RAttributeArray &apAttrs)[pure virtual]
    Adds new attributes to the element.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0
    ParameterDescription
    aNsUrinamespace URI of the new element
    aLocalNamelocal name of the new 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.
    Since
    Series60 3.0
    KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
    ParameterDescription
    aNsUrinamespace URI of the new element
    aLocalNamelocal name of the new element
    aQNamequalified name of the new element

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

    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.
    Since
    Series60 3.0
    KErrSenZeroLengthDescriptor if aLocalName is zero length.
    ParameterDescription
    aLocalNamelocal name of the new element

    Returns: the added Element Leave codes: KErrSenInvalidCharacters if aLocalName contains illegal characters.

    AddNamespaceL ( const TDesC8 &, const TDesC8 & )

    const CSenNamespace *AddNamespaceL(const TDesC8 &aPrefix,
    const TDesC8 &aUri
    )[pure virtual]
    Method for adding a namespace for the Element.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

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

    AsElement ( )

    MSenElement *AsElement()[pure virtual]
    Offers the M-class interface pointer to this XML element.
    Since
    Series60 3.0

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

    AsXmlL ( )

    HBufC8 *AsXmlL()[pure virtual]
    Gets the element as an XML buffer. Buffer will contain all the child elements.
    Since
    Series60 3.0

    Returns: element as XML. Caller takes ownership.

    AsXmlUnicodeL ( )

    HBufC *AsXmlUnicodeL()[pure virtual]
    Gets the element as an unicode (UCS2) XML buffer. Buffer will contain all the child elements.
    Since
    Series60 3.0

    Returns: element as XML. Caller takes ownership.

    AttrValue ( const TDesC8 & )

    const TDesC8 *AttrValue(const TDesC8 &aName)[pure virtual]
    Gets the value of the given attribute.
    Since
    Series60 3.0

    Returns: the value of the attribute, or NULL if not found. Ownership is not transferred to caller.

    AttributesL ( )

    RPointerArray< CSenBaseAttribute > &AttributesL()[pure virtual]
    Gets all the attributes of this element in an array.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

    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 it's 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.
    Since
    Series60 3.0

    Returns: the content or KNullDesC8 if empty.

    ContentUnicodeL ( )

    HBufC *ContentUnicodeL()const [pure virtual]
    Getter for the content of the element, Unicode (UCS2) version
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0
    ParameterDescription
    aSourceThe source element.

    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.
    Since
    Series60 3.0

    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 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.
    Since
    Series60 3.0

    Returns: this Element. Ownership is NOT transferred to the caller. or 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.
    Since
    Series60 3.0
    ParameterDescription
    aLocalNameis the XML localname of the requested child 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.
    Since
    Series60 3.0
    ParameterDescription
    aNsUriis the XML namespace of the requested child element
    aLocalNameis the XML localname of the requested child element

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

    ElementsL ( RPointerArray< CSenElement > &, const TDesC8 &, const TDesC8 & )

    TInt ElementsL(RPointerArray< CSenElement > &aElementArray,
    const TDesC8 &aNsUri,
    const TDesC8 &aLocalName
    )[pure virtual]
    Get a list of direct children element that have the given name and namespace.
    Since
    Series60 3.0
    ParameterDescription
    aElementArrayRPointerArray that will hold matching elements

    Returns: KErrNone or some system-wide error code, if an error has occurred.

    ElementsL ( RPointerArray< CSenElement > &, const TDesC8 & )

    TInt ElementsL(RPointerArray< CSenElement > &aElementArray,
    const TDesC8 &aLocalName
    )[pure virtual]
    Get a list of direct children element that have the given name and same namespace as this parent Element.
    Since
    Series60 3.0
    ParameterDescription
    aElementArrayRPointerArray that will hold matching elements

    Returns: KErrNone or some system-wide error code, if an error has occurred.

    ElementsL ( )

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

    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.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0
    ParameterDescription
    aInsertedElementthe element to be inserted. Ownership is transferred.
    aBeforeElementthe element which will be right next to the element just inserted.

    Returns: the inserted Element

    LocalName ( )

    const TDesC8 &LocalName()const [pure virtual]
    Getter for local name.
    Since
    Series60 3.0

    Returns: KNullDesC if not set (argumentless constructor).

    Namespace ( )

    const CSenNamespace *Namespace()[pure virtual]
    Getter for Element's namespace.
    Since
    Series60 3.0

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

    Namespace ( const TDesC8 & )

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

    Returns: the namespace that is declared for the given prefix within the scope of this Element. If no such prefix is declared return NULL.

    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.
    Since
    Series60 3.0
    ParameterDescription
    aNsPrefixThe prefix used to search
    aUriThe namespace URI used to search.

    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]
    Since
    Series60 3.0
    ParameterDescription
    aNsPrefixThe prefix used to search
    aCheckInParentThe flag indicating whether to check parent's namespaces too if not found in the current element. ETrue to check, EFalse for not to check.

    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 namespace URI.
    Since
    Series60 3.0

    Returns: KNullDesC if not set.

    NamespacesL ( )

    RPointerArray< CSenNamespace > &NamespacesL()[pure virtual]
    Gets all the namespaces of this element in an array.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

    Returns: namespace prefix or KNullDesC8 if not set.

    Parent ( )

    CSenElement *Parent()[pure virtual]
    Gets the parent element of this element.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

    Returns: The removed element. May be NULL if nothing was removed (if child element was not found). 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.
    Since
    Series60 3.0

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

    RemoveElement ( const TDesC8 & )

    CSenElement *RemoveElement(const TDesC8 &aLocalName)[pure virtual]
    Remove a child element.
    Since
    Series60 3.0
    The caller takes ownership of the removed element.

    Returns: The removed element. May be NULL if nothing was removed (if child element was not found).

    ReplaceElementL ( CSenElement & )

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

    Replaces a child element with another element. Element's local name and namespace URI will be used to check whether or not that element matches with any existing child. If no matching child element is found this method will add a new child element.

    Since
    Series60 3.0

    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.
    Since
    Series60 3.0

    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.
    Since
    Series60 3.0
    ParameterDescription
    aNamespaceURIThe new namespace URI.
    aLocalNameThe new local name.
    aQNameThe new qualified name.

    SetContentL ( const TDesC8 & )

    TPtrC8 SetContentL(const TDesC8 &aContent)[pure virtual]
    Sets the content to the element. Old content is overwritten.
    Since
    Series60 3.0
    ParameterDescription
    aContentThe content to be set. Can be KNullDesC8.

    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.
    Since
    Series60 3.0

    SetNamespaceL ( const TDesC8 &, const TDesC8 & )

    voidSetNamespaceL(const TDesC8 &aNsPrefix,
    const TDesC8 &aNsUri
    )[pure virtual]
    Setter for Element's namespace URI.
    Since
    Series60 3.0

    SetParent ( CSenElement * )

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

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

    Since
    Series60 3.0

    Returns: the parent element

    SetPrefixL ( const TDesC8 & )

    voidSetPrefixL(const TDesC8 &aPrefix)[pure virtual]
    Setter for namespace prefix of this element.
    Since
    Series60 3.0

    WriteAsXMLToL ( RWriteStream & )

    voidWriteAsXMLToL(RWriteStream &aWriteStream)[pure virtual]
    Element writes itself to a write stream using UTF-8 character-set encoding.
    Since
    Series60 3.0
    ParameterDescription
    aWriteStreamThe stream to write to.

    WriteNamespacesToL ( RWriteStream & )

    voidWriteNamespacesToL(RWriteStream &aWriteStream)[pure virtual]
    Element writes its namespaces to a write stream using UTF-8 character-set encoding.
    Since
    Series60 3.0
    ParameterDescription
    aWriteStreamThe stream to write to.