epoc32/include/mw/senelement.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:        Central place for debug-type macros
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
williamr@2
    25
#ifndef SEN_ELEMENT_H
williamr@2
    26
#define SEN_ELEMENT_H
williamr@2
    27
williamr@2
    28
//  INCLUDES
williamr@2
    29
#include <e32base.h>
williamr@2
    30
#include <s32strm.h>
williamr@4
    31
#include <xml/attribute.h>
williamr@2
    32
#include <stringpool.h>
williamr@2
    33
williamr@2
    34
#include <MSenElement.h>
williamr@2
    35
williamr@2
    36
using namespace Xml;
williamr@2
    37
williamr@2
    38
// CLASS DECLARATION
williamr@2
    39
williamr@2
    40
/**
williamr@2
    41
*  Abstract class definition of XML element
williamr@2
    42
*  @lib SenXML.dll
williamr@2
    43
*  @since Series60 3.0
williamr@2
    44
*/
williamr@2
    45
class CSenElement : public CBase, public MSenElement
williamr@2
    46
    {
williamr@2
    47
    public: // Functions from base classes
williamr@2
    48
williamr@2
    49
        // From MSenElement 
williamr@2
    50
        
williamr@2
    51
        /**
williamr@2
    52
        * Getter for local name.
williamr@2
    53
        * @since Series60 3.0
williamr@2
    54
        * @return KNullDesC if not set (argumentless constructor).
williamr@2
    55
        */
williamr@2
    56
        virtual const TDesC8& LocalName() const = 0;
williamr@2
    57
williamr@2
    58
        /**
williamr@2
    59
        * Getter for namespace URI.
williamr@2
    60
        * @since Series60 3.0
williamr@2
    61
        * @return KNullDesC if not set.
williamr@2
    62
        */      
williamr@2
    63
        virtual const TDesC8& NamespaceURI() const = 0;
williamr@2
    64
williamr@2
    65
        /**
williamr@2
    66
        * Setter for Element's namespace URI.
williamr@2
    67
        * @since Series60 3.0
williamr@2
    68
        * @param @param aNsUri: Namespace URI
williamr@2
    69
        */      
williamr@2
    70
        virtual void SetNamespaceL(const TDesC8& aNsUri) = 0;
williamr@2
    71
williamr@2
    72
        /**
williamr@2
    73
        * Setter for Element's namespace URI.
williamr@2
    74
        * @since Series60 3.0
williamr@2
    75
        * @param aNsPrefix: Namespace prefix
williamr@2
    76
        * @param aNsUri:        Namespace URI
williamr@2
    77
        */      
williamr@2
    78
        virtual void SetNamespaceL( const TDesC8& aNsPrefix,
williamr@2
    79
                                    const TDesC8& aNsUri) = 0;
williamr@2
    80
williamr@2
    81
        /**
williamr@2
    82
        * Method for adding a namespace for the Element.
williamr@2
    83
        * @since Series60 3.0
williamr@2
    84
        * @param aPrefix:   Namespace prefix
williamr@2
    85
        * @param aUri:  Namespace URI
williamr@2
    86
        * @return the added Namespace, or the equivalent pre-existing one.
williamr@2
    87
        */      
williamr@2
    88
        virtual const CSenNamespace* AddNamespaceL( const TDesC8& aPrefix,
williamr@2
    89
                                                    const TDesC8& aUri) = 0;
williamr@2
    90
williamr@2
    91
        /**
williamr@2
    92
        * Getter for Element's namespace.
williamr@2
    93
        * @since Series60 3.0
williamr@2
    94
        * @return const pointer to the CSenNamespace object of this Element.
williamr@2
    95
        *         Returns NULL, if not set.
williamr@2
    96
        */      
williamr@2
    97
        virtual const CSenNamespace* Namespace() = 0;
williamr@2
    98
williamr@2
    99
        /**
williamr@2
   100
        * @since Series60 3.0
williamr@2
   101
        * @param prefix
williamr@2
   102
        * @return the namespace that is declared for the given prefix
williamr@2
   103
        *         within the scope of this Element. If no such prefix is
williamr@2
   104
        *         declared return NULL.
williamr@2
   105
        */      
williamr@2
   106
        virtual const CSenNamespace* Namespace(const TDesC8& aNsPrefix) = 0;
williamr@2
   107
williamr@2
   108
        /**
williamr@2
   109
        * Get namespace that is declared for the given prefix and namespace 
williamr@2
   110
        * URI within the scope of this element. 
williamr@2
   111
        * @since Series60 3.0
williamr@2
   112
        * @param aNsPrefix  The prefix used to search
williamr@2
   113
        * @param aUri           The namespace URI used to search.
williamr@2
   114
        * @return the found namespace that is declared for the given prefix 
williamr@2
   115
        *                   and namespace URI within the scope of this Element
williamr@2
   116
        *                   or NULL if not found.
williamr@2
   117
        */
williamr@2
   118
        virtual const CSenNamespace* Namespace( const TDesC8& aNsPrefix,
williamr@2
   119
                                                const TDesC8& aUri) = 0;
williamr@2
   120
williamr@2
   121
        /**
williamr@2
   122
        * @since Series60 3.0
williamr@2
   123
        * @param aNsPrefix      The prefix used to search
williamr@2
   124
        * @param aCheckInParent The flag indicating whether to check parent's
williamr@2
   125
        *                       namespaces too if not found in the current 
williamr@2
   126
        *                       element. 
williamr@2
   127
        *                       ETrue to check, EFalse for not to check.
williamr@2
   128
        * @return the found Namespace that is declared for the given prefix 
williamr@2
   129
        *                   and namespace URI within the scope of this Element
williamr@2
   130
        *                   or NULL if not found
williamr@2
   131
        */
williamr@2
   132
        virtual const CSenNamespace* Namespace( const TDesC8& aNsPrefix,
williamr@2
   133
                                                const TBool aCheckInParent) = 0;
williamr@2
   134
williamr@2
   135
        /**
williamr@2
   136
        * Getter for namespace prefix of this element.
williamr@2
   137
        * @since Series60 3.0
williamr@2
   138
        * @return namespace prefix or KNullDesC8 if not set.
williamr@2
   139
        */
williamr@2
   140
        virtual const TDesC8& NsPrefix() const = 0;
williamr@2
   141
williamr@2
   142
        /**
williamr@2
   143
        * Setter for namespace prefix of this element.
williamr@2
   144
        * @since Series60 3.0
williamr@2
   145
        * @param aPrefix:   new namespace prefix for the element.
williamr@2
   146
        */
williamr@2
   147
        virtual void SetPrefixL(const TDesC8& aPrefix) = 0;
williamr@2
   148
williamr@2
   149
        /**
williamr@2
   150
        * Method for checking if the element has any content within.
williamr@2
   151
        * @since Series60 3.0
williamr@2
   152
        * @return ETrue if has content, EFalse if not.
williamr@2
   153
        */
williamr@2
   154
        virtual TBool HasContent() const = 0;
williamr@2
   155
williamr@2
   156
        /**
williamr@2
   157
        * Getter for the content of the element.
williamr@2
   158
        * @since Series60 3.0
williamr@2
   159
        * @return the content or KNullDesC8 if empty.
williamr@2
   160
        */
williamr@2
   161
        virtual TPtrC8 Content() const = 0;
williamr@2
   162
williamr@2
   163
        /**
williamr@2
   164
        * Getter for the content of the element, Unicode (UCS2) version
williamr@2
   165
        * @since Series60 3.0
williamr@2
   166
        * @return content as Unicode. Ownership is transferred to the caller.
williamr@2
   167
        */
williamr@2
   168
        virtual HBufC* ContentUnicodeL() const = 0;
williamr@2
   169
        
williamr@2
   170
        /**
williamr@2
   171
        * Sets the content to the element. Old content is overwritten.
williamr@2
   172
        * @since Series60 3.0
williamr@2
   173
        * @param aContent   The content to be set. Can be KNullDesC8.
williamr@2
   174
        * @return The content of the element or KNullDesC8 if no content was set.
williamr@2
   175
        */
williamr@2
   176
        virtual TPtrC8 SetContentL(const TDesC8& aContent) = 0;
williamr@2
   177
williamr@2
   178
        /**
williamr@2
   179
        * Gets the write stream for the content for easy appending.
williamr@2
   180
        * Writing 8-bit (UTF-8) string to the returned stream will be appended
williamr@2
   181
        * to the content.
williamr@2
   182
        * @since Series60 3.0
williamr@2
   183
        * @return reference to the RWriteStream.
williamr@2
   184
        */
williamr@2
   185
        virtual RWriteStream& ContentWriteStreamL() = 0;
williamr@2
   186
williamr@2
   187
        /**
williamr@2
   188
         * Checks if element matches to another element
williamr@2
   189
         * by it's content and child elements. Element
williamr@2
   190
         * can contain more data than the given pattern.
williamr@2
   191
         * @since Series60 3.0
williamr@2
   192
         * @param   aCandidate The pattern to be matched. Must contain 
williamr@2
   193
         *          same or less data for match to come true.
williamr@2
   194
         * @return  ETrue if content and possible children match exactly 
williamr@2
   195
         *          to given pattern. EFalse otherwise.
williamr@2
   196
         */
williamr@2
   197
        virtual TBool ConsistsOfL(MSenElement& aCandidate) = 0;
williamr@2
   198
williamr@2
   199
        /**
williamr@2
   200
        * Get a list of direct children element that have the given
williamr@2
   201
        * name and namespace.
williamr@2
   202
        * @since Series60 3.0
williamr@2
   203
        * @param    aElementArray RPointerArray that will hold matching elements
williamr@2
   204
        * @param    namespaceURI
williamr@2
   205
        * @param    localName
williamr@2
   206
        * @return   KErrNone or some system-wide error code, 
williamr@2
   207
        *           if an error has occurred.
williamr@2
   208
        */
williamr@2
   209
        virtual TInt ElementsL(RPointerArray<CSenElement>& aElementArray,
williamr@2
   210
                                const TDesC8& aNsUri,
williamr@2
   211
                                const TDesC8& aLocalName) = 0;
williamr@2
   212
williamr@2
   213
        /**
williamr@2
   214
        * Get a list of direct children element that have the given
williamr@2
   215
        * name and same namespace as this parent Element.
williamr@2
   216
        * @since Series60 3.0
williamr@2
   217
        * @param    aElementArray RPointerArray that will hold matching elements
williamr@2
   218
        * @param    localName
williamr@2
   219
        * @return   KErrNone or some system-wide error code, 
williamr@2
   220
        *           if an error has occurred.
williamr@2
   221
        */
williamr@2
   222
        virtual TInt ElementsL(RPointerArray<CSenElement>& aElementArray,
williamr@2
   223
                                const TDesC8& aLocalName) = 0;
williamr@2
   224
williamr@2
   225
        /**
williamr@2
   226
        * @since Series60 3.0
williamr@2
   227
        * @return an array of child elements. This is an empty array if there
williamr@2
   228
        * are no children. Any modifications made on the returned array modify
williamr@2
   229
        * the element object.
williamr@2
   230
        */
williamr@2
   231
        virtual RPointerArray<CSenElement>& ElementsL() = 0;
williamr@2
   232
        
williamr@2
   233
        /**
williamr@2
   234
        * Adds a namespace declaration.
williamr@2
   235
        * If this element (or its parent if parameter aCheckInParent is ETrue) 
williamr@2
   236
        * already has a namespace with the same prefix and URI the given
williamr@2
   237
        * namespace is not added.
williamr@2
   238
        * @since Series60 3.0
williamr@2
   239
        * @param aNewNamespace
williamr@2
   240
        * @param aCheckInParent
williamr@2
   241
        * @return the added Namespace, or the equivalent pre-existing one.
williamr@2
   242
        */
williamr@2
   243
        virtual const CSenNamespace* AddNamespaceL(CSenNamespace& aNewNamespace,
williamr@2
   244
                                                    TBool aCheckInParent) = 0;
williamr@2
   245
williamr@2
   246
        /**
williamr@2
   247
        * Gets the value of the given attribute.
williamr@2
   248
        * @since Series60 3.0
williamr@2
   249
        * @param aName: Name of the attribute in question.
williamr@2
   250
        * @return the value of the attribute, or NULL if not found. 
williamr@2
   251
        * Ownership is not transferred to caller.
williamr@2
   252
        */
williamr@2
   253
        virtual const TDesC8* AttrValue(const TDesC8& aName) = 0;
williamr@2
   254
williamr@2
   255
        /**
williamr@2
   256
        * Adds an attribute. If attribute is already existing, 
williamr@2
   257
        *                  the value of the attribute will be replaced.
williamr@2
   258
        * @since Series60 3.0
williamr@2
   259
        * @param aName      Name of the attribute to be added.
williamr@2
   260
        * @param aValue Value of the attribute to be added.
williamr@2
   261
        */
williamr@2
   262
        virtual void AddAttrL(const TDesC8& aName, const TDesC8& aValue) = 0;
williamr@2
   263
williamr@2
   264
        /**
williamr@2
   265
        * Gets all the attributes of this element in an array.
williamr@2
   266
        * @since Series60 3.0
williamr@2
   267
        * @return array of attributes. Array will be empty if element has 
williamr@2
   268
        *         no attributes.
williamr@2
   269
        */
williamr@2
   270
        virtual RPointerArray<CSenBaseAttribute>& AttributesL() = 0;
williamr@2
   271
williamr@2
   272
        /**
williamr@2
   273
        * Gets all the namespaces of this element in an array.
williamr@2
   274
        * @since Series60 3.0
williamr@2
   275
        * @return array of namespaces. Array will be empty if element has 
williamr@2
   276
        *         no namespaces.
williamr@2
   277
        */
williamr@2
   278
        virtual RPointerArray<CSenNamespace>& NamespacesL() = 0;
williamr@2
   279
williamr@2
   280
        /**
williamr@2
   281
        * Gets the parent element of this element.
williamr@2
   282
        * @since Series60 3.0
williamr@2
   283
        * @return the parent element or NULL if no parent set. 
williamr@2
   284
        *           Ownership is NOT transferred to the caller.
williamr@2
   285
        */
williamr@2
   286
        virtual CSenElement* Parent() = 0;
williamr@2
   287
williamr@2
   288
        /**
williamr@2
   289
        * From MSenElement  Sets the parent element to this element. 
williamr@2
   290
        * Notice that the element is not automatically added as a 
williamr@2
   291
        * child of the parent. Parent's AddElementL() must be called 
williamr@2
   292
        * to achieve that.
williamr@2
   293
        *
williamr@2
   294
        * @since Series60 3.0
williamr@2
   295
        * @param apParent:  The wanted parent. Can be NULL.
williamr@2
   296
        * @return   the parent element
williamr@2
   297
        */
williamr@2
   298
        virtual CSenElement* SetParent(CSenElement* apParent) = 0;
williamr@2
   299
williamr@2
   300
        /**
williamr@2
   301
        * Detach the element from its parent.
williamr@2
   302
        * If the element, or one of its children, is dependent
williamr@2
   303
        * on a namespace declared in the scope of the parent
williamr@2
   304
        * copy those namespace declarations to this element.
williamr@2
   305
        * @since Series60 3.0
williamr@2
   306
        * @return this Element. Ownership is NOT transferred to the caller.
williamr@2
   307
        *         or NULL if no parent was set, and nothing was detached.
williamr@2
   308
        */
williamr@2
   309
        virtual CSenElement* DetachL() = 0;
williamr@2
   310
williamr@2
   311
        /**
williamr@2
   312
        * Gets a child element from a specified index.
williamr@2
   313
        * @since Series60 3.0
williamr@2
   314
        * @param  aIndex:   the index what to get
williamr@2
   315
        * @return child element from a current index. NULL if no child in given
williamr@2
   316
        *         index is found
williamr@2
   317
        */
williamr@2
   318
        virtual CSenElement* Child(TInt aIndex) = 0;
williamr@2
   319
williamr@2
   320
        /**
williamr@2
   321
        * Gets the root element. If no parent element, returns this element.
williamr@2
   322
        * @since Series60 3.0
williamr@2
   323
        * @return the root of the tree. Ownership is not transferred.
williamr@2
   324
        */
williamr@2
   325
        virtual MSenElement& Root() = 0;
williamr@2
   326
williamr@2
   327
        /**
williamr@2
   328
        * Gets the child element with the specified local name.
williamr@2
   329
        * Assumes that namespace is the same as this parent element.
williamr@2
   330
        * @since Series60 3.0
williamr@2
   331
        * @param aLocalName is the XML localname of the requested child element
williamr@2
   332
        * @return   the child element or NULL if the child with the specified 
williamr@2
   333
        *           local name is not found. Ownership is NOT transferred.
williamr@2
   334
        */
williamr@2
   335
        virtual CSenElement* Element(const TDesC8& aLocalName) = 0;
williamr@2
   336
williamr@2
   337
        /**
williamr@2
   338
        * Gets the child element with the specified local name and namespace URI.
williamr@2
   339
        * @since Series60 3.0
williamr@2
   340
        * @param aNsUri is the XML namespace of the requested child element
williamr@2
   341
        * @param aLocalName  is the XML localname of the requested child element
williamr@2
   342
        * @return   the child element or NULL if the child with the specified 
williamr@2
   343
        *           criterias is not found. Ownership is NOT transferred.
williamr@2
   344
        */
williamr@2
   345
        virtual CSenElement* Element(const TDesC8& aNsUri,
williamr@2
   346
                                     const TDesC8& aLocalName) = 0;
williamr@2
   347
williamr@2
   348
        /**
williamr@2
   349
        * Create a new element ready for adding or insertion.
williamr@2
   350
        * If the given namespace prefix is not declared yet
williamr@2
   351
        * the element will not be created and NULL will be returned.
williamr@2
   352
        * @since Series60 3.0
williamr@2
   353
        * @param aNsPrefix: The namespace prefix
williamr@2
   354
        * @param aLocalName:    The new elements localname
williamr@2
   355
        * @return   the new Element just created, or NULL if given prefix was not
williamr@2
   356
        *           declared yet. Ownership is transferred to the caller.
williamr@2
   357
        * Leave codes:  
williamr@2
   358
        *       KErrSenInvalidCharacters if aLocalName contain illegal characters.      
williamr@2
   359
        *       KErrSenZeroLengthDescriptor if aLocalName is zero length.
williamr@2
   360
        */
williamr@2
   361
        virtual CSenElement* CreateElementL(const TDesC8& aNsPrefix,
williamr@2
   362
                                            const TDesC8& aLocalName) = 0;
williamr@2
   363
williamr@2
   364
        /**
williamr@2
   365
        * Insert an Element into the list of children elements
williamr@2
   366
        * so that the inserted Element is placed right before the aBeforeElement.
williamr@2
   367
        * If aBeforeElement is not found, element will be appended to the last
williamr@2
   368
        * position.
williamr@2
   369
        * Function leaves if error occurs in inserting.
williamr@2
   370
        * @since Series60 3.0
williamr@2
   371
        * @param aInsertedElement   the element to be inserted. 
williamr@2
   372
        *                           Ownership is transferred.
williamr@2
   373
        * @param aBeforeElement     the element which will be right next to the 
williamr@2
   374
        *                           element just inserted.
williamr@2
   375
        * @return the inserted Element
williamr@2
   376
        */
williamr@2
   377
        virtual CSenElement& InsertElementL(CSenElement& aInsertedElement,
williamr@2
   378
                                            const CSenElement& aBeforeElement) = 0;
williamr@2
   379
williamr@2
   380
        /**
williamr@2
   381
        * Adds an Element to the children elements. 
williamr@2
   382
        * Sets this element to be the new parent of the given element.
williamr@2
   383
        * @since Series60 3.0
williamr@2
   384
        * @param aElement:  the element to be added. Ownership is transferred.
williamr@2
   385
        * @return the added Element
williamr@2
   386
        */
williamr@2
   387
        virtual CSenElement& AddElementL(CSenElement& aElement) = 0;
williamr@2
   388
williamr@2
   389
        /**
williamr@2
   390
        * Constructs and adds a new element to the children elements. 
williamr@2
   391
        * Sets this element to be the new parent of the given element.
williamr@2
   392
        * @since Series60 3.0
williamr@2
   393
        * @param aNsUri     namespace URI of the new element
williamr@2
   394
        * @param aLocalName local name of the new element
williamr@2
   395
        * @return the added Element
williamr@2
   396
        * Leave codes:  
williamr@2
   397
        *       KErrSenInvalidCharacters if aLocalName contains illegal characters.     
williamr@2
   398
        *       KErrSenZeroLengthDescriptor if aLocalName is zero length.
williamr@2
   399
        */
williamr@2
   400
        virtual CSenElement& AddElementL(   const TDesC8& aNsUri,
williamr@2
   401
                                            const TDesC8& aLocalName) = 0;
williamr@2
   402
        
williamr@2
   403
        /**
williamr@2
   404
        * Constructs and adds a new element to the children elements. 
williamr@2
   405
        * Sets this element to be the new parent of the given element.
williamr@2
   406
        * @since Series60 3.0
williamr@2
   407
        * @param aNsUri     namespace URI of the new element
williamr@2
   408
        * @param aLocalName local name of the new element
williamr@2
   409
        * @param aQName     qualified name of the new element
williamr@2
   410
        * @return the added Element
williamr@2
   411
        * Leave codes:  
williamr@2
   412
        *       KErrSenInvalidCharacters if aLocalName or aQName contain illegal 
williamr@2
   413
        *       characters.     
williamr@2
   414
        *
williamr@2
   415
        *       KErrSenZeroLengthDescriptor if aLocalName or aQName is zero 
williamr@2
   416
        *       length.
williamr@2
   417
        */
williamr@2
   418
        virtual CSenElement& AddElementL(const TDesC8& aNsUri,
williamr@2
   419
                                         const TDesC8& aLocalName,
williamr@2
   420
                                         const TDesC8& aQName) = 0;
williamr@2
   421
williamr@2
   422
        /**
williamr@2
   423
        * Constructs and adds a new element to the children elements. 
williamr@2
   424
        * Sets this element to be the new parent of the given element.
williamr@2
   425
        * Note: Element is created with no specific namespace, default namespace
williamr@2
   426
        * of some of the upper level elements are in effect if there is such a 
williamr@2
   427
        * namespace.
williamr@2
   428
        * @since Series60 3.0
williamr@2
   429
        * @param aLocalName local name of the new element
williamr@2
   430
        * @return the added Element
williamr@2
   431
        * Leave codes:  
williamr@2
   432
        *       KErrSenInvalidCharacters if aLocalName contains illegal 
williamr@2
   433
        *       characters.     
williamr@2
   434
        *
williamr@2
   435
        *       KErrSenZeroLengthDescriptor if aLocalName is zero length.
williamr@2
   436
        */
williamr@2
   437
        virtual CSenElement& AddElementL(const TDesC8& aLocalName) = 0;
williamr@2
   438
williamr@2
   439
        /**
williamr@2
   440
        * Remove an element from the childs.
williamr@2
   441
        * @since Series60 3.0
williamr@2
   442
        * @param aElement:  the element to be removed.
williamr@2
   443
        * @return The removed element. May be NULL if nothing was removed
williamr@2
   444
        *           (if child element was not found).
williamr@2
   445
        *           The caller TAKES OWNERSHIP of the removed element.
williamr@2
   446
        */
williamr@2
   447
        virtual CSenElement* RemoveElement(CSenElement& aElement) = 0;
williamr@2
   448
williamr@2
   449
        /**
williamr@2
   450
        * Remove an element from the childs.
williamr@2
   451
        * @since Series60 3.0
williamr@2
   452
        * @param    aNsUri:     the namespace URI of the element to be removed.
williamr@2
   453
        * @param    aLocalName: the local name of the element to be removed.
williamr@2
   454
        * @return The removed element. May be NULL if nothing was removed
williamr@2
   455
        *           (if child element was not found).
williamr@2
   456
        *           The caller TAKES OWNERSHIP of the removed element.
williamr@2
   457
        */
williamr@2
   458
        virtual CSenElement* RemoveElement( const TDesC8& aNsUri,
williamr@2
   459
                                            const TDesC8& aLocalName) = 0;
williamr@2
   460
williamr@2
   461
        /**
williamr@2
   462
        * Remove a child element.
williamr@2
   463
        * @since Series60 3.0
williamr@2
   464
        * @param    aLocalName: the local name of the element to be removed.
williamr@2
   465
        * @return The removed element. May be NULL if nothing was removed
williamr@2
   466
        *           (if child element was not found).
williamr@2
   467
        *
williamr@2
   468
        * The caller takes ownership of the removed element.
williamr@2
   469
        */
williamr@2
   470
        virtual CSenElement* RemoveElement(const TDesC8& aLocalName) = 0;
williamr@2
   471
williamr@2
   472
        /**
williamr@2
   473
        * Replaces a child element with another element.
williamr@2
   474
        * Element's local name and namespace URI will be used to check
williamr@2
   475
        * whether or not that element matches with any existing child.
williamr@2
   476
        * If no matching child element is found this method will add a 
williamr@2
   477
        * new child element.
williamr@2
   478
        *
williamr@2
   479
        * @since Series60 3.0
williamr@2
   480
        * @param aElement:  the element to be added. Ownership is transferred.
williamr@2
   481
        * @return The old element. May be NULL if nothing was replaced
williamr@2
   482
        *           (if element was not found from the childs).
williamr@2
   483
        *           The caller TAKES OWNERSHIP of the old element.
williamr@2
   484
        */
williamr@2
   485
        virtual CSenElement* ReplaceElementL(CSenElement& aElement) = 0;
williamr@2
   486
williamr@2
   487
        /**
williamr@2
   488
        * Gets the element as an XML buffer. Buffer will 
williamr@2
   489
        * contain all the child elements.
williamr@2
   490
        * @since Series60 3.0
williamr@2
   491
        * @return element as XML. Caller takes ownership.
williamr@2
   492
        */
williamr@2
   493
        virtual HBufC8* AsXmlL() = 0;
williamr@2
   494
        
williamr@2
   495
        /**
williamr@2
   496
        * Gets the element as an unicode (UCS2) XML buffer.
williamr@2
   497
        * Buffer will contain all the child elements.
williamr@2
   498
        * @since Series60 3.0
williamr@2
   499
        * @return element as XML. Caller takes ownership.
williamr@2
   500
        */
williamr@2
   501
        virtual HBufC* AsXmlUnicodeL() = 0;
williamr@2
   502
williamr@2
   503
        /**
williamr@2
   504
        * Element writes itself to a write stream using UTF-8 
williamr@2
   505
        * character-set encoding.
williamr@2
   506
        * @since Series60 3.0
williamr@2
   507
        * @param aWriteStream The stream to write to.
williamr@2
   508
        */
williamr@2
   509
        virtual void WriteAsXMLToL(RWriteStream& aWriteStream) = 0;
williamr@2
   510
williamr@2
   511
        /**
williamr@2
   512
        * Element writes its namespaces to a write stream 
williamr@2
   513
        * using UTF-8 character-set encoding.
williamr@2
   514
        * @since Series60 3.0
williamr@2
   515
        * @param aWriteStream The stream to write to.
williamr@2
   516
        */
williamr@2
   517
        virtual void WriteNamespacesToL(RWriteStream& aWriteStream) = 0;
williamr@2
   518
williamr@2
   519
        /**
williamr@2
   520
        * Offers the M-class interface pointer to this XML 
williamr@2
   521
        * element.
williamr@2
   522
        * @since Series60 3.0
williamr@2
   523
        * @return the current object as element. Ownership is NOT transferred.
williamr@2
   524
        */
williamr@2
   525
        virtual MSenElement* AsElement() = 0;
williamr@2
   526
williamr@2
   527
        /**
williamr@2
   528
        * Copies content from given element to this element appending to the 
williamr@2
   529
        * existing content if there is any.
williamr@2
   530
        * @since Series60 3.0
williamr@2
   531
        * @param aSource The source element.
williamr@2
   532
        */
williamr@2
   533
        virtual void CopyFromL(CSenElement& aSource) = 0;
williamr@2
   534
williamr@2
   535
        /**
williamr@2
   536
        * (Re-) Set the name and namespace of this Element. The element will be
williamr@2
   537
        * given the localName in the the given namespace. A prefix will be
williamr@2
   538
        * computed from the qualified name.
williamr@2
   539
        * This method should be used with care and is mainly intended for
williamr@2
   540
        * protected use in implementations.
williamr@2
   541
        * @since Series60 3.0
williamr@2
   542
        * @param aNamespaceURI The new namespace URI.
williamr@2
   543
        * @param aLocalName The new local name.
williamr@2
   544
        * @param aQName The new qualified name.
williamr@2
   545
        */
williamr@2
   546
        virtual void Set(const TDesC8& aNamespaceURI, const TDesC8& aLocalName, const TDesC8& aQName) = 0;
williamr@2
   547
williamr@2
   548
        /**
williamr@2
   549
        * Adds new attributes to the element.
williamr@2
   550
        * @since Series60 3.0
williamr@2
   551
        * @param aAttrs:    the array of attributes.
williamr@2
   552
        */
williamr@2
   553
        virtual void AddAttributesL(const RAttributeArray& apAttrs) = 0;
williamr@2
   554
    };
williamr@2
   555
williamr@2
   556
#endif //SEN_ELEMENT_H
williamr@2
   557
williamr@2
   558
// End of File
williamr@2
   559