| 
williamr@2
 | 
     1  | 
/*
  | 
| 
williamr@2
 | 
     2  | 
* Copyright (c) 2002-2006 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:        Class implements XML base fragment using libxml2 classes
  | 
| 
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  | 
  | 
| 
williamr@2
 | 
    26  | 
#ifndef SEN_FRAGMENT_BASE_H
  | 
| 
williamr@2
 | 
    27  | 
#define SEN_FRAGMENT_BASE_H
  | 
| 
williamr@2
 | 
    28  | 
  | 
| 
williamr@2
 | 
    29  | 
// INCLUDES
  | 
| 
williamr@2
 | 
    30  | 
#include <s32mem.h>
  | 
| 
williamr@2
 | 
    31  | 
  | 
| 
williamr@4
 | 
    32  | 
#include <xml/contenthandler.h>
  | 
| 
williamr@2
 | 
    33  | 
#include <RSenDocument.h>
  | 
| 
williamr@2
 | 
    34  | 
#include <SenParser.h>
  | 
| 
williamr@4
 | 
    35  | 
#include <xmlengelement.h>
  | 
| 
williamr@2
 | 
    36  | 
  | 
| 
williamr@2
 | 
    37  | 
using namespace Xml;
  | 
| 
williamr@2
 | 
    38  | 
  | 
| 
williamr@2
 | 
    39  | 
// CONSTANTS
  | 
| 
williamr@2
 | 
    40  | 
  | 
| 
williamr@2
 | 
    41  | 
// Fragment's internal states.
  | 
| 
williamr@2
 | 
    42  | 
const TInt KSenStateNotSet      = -1;
  | 
| 
williamr@2
 | 
    43  | 
const TInt KSenStateIgnore      =  0;
  | 
| 
williamr@2
 | 
    44  | 
const TInt KSenStateSave        =  1;
  | 
| 
williamr@2
 | 
    45  | 
const TInt KSenStateResume      =  2;
  | 
| 
williamr@2
 | 
    46  | 
const TInt KSenStateDelegate    =  3;
  | 
| 
williamr@2
 | 
    47  | 
  | 
| 
williamr@2
 | 
    48  | 
// FORWARD DECLARATIONS
  | 
| 
williamr@2
 | 
    49  | 
class RWriteStream;
  | 
| 
williamr@2
 | 
    50  | 
//class CSenParser;
  | 
| 
williamr@2
 | 
    51  | 
class CSenNamespaceData;
  | 
| 
williamr@2
 | 
    52  | 
  | 
| 
williamr@2
 | 
    53  | 
// CLASS DECLARATION
  | 
| 
williamr@2
 | 
    54  | 
  | 
| 
williamr@2
 | 
    55  | 
/**
  | 
| 
williamr@2
 | 
    56  | 
* Class implements basic functionality of an XML fragment
  | 
| 
williamr@2
 | 
    57  | 
* Typically base fragment is used to parse certain part of some XML document.
  | 
| 
williamr@2
 | 
    58  | 
* The element is identified by local name (or qualified name) and namespace.
  | 
| 
williamr@2
 | 
    59  | 
* All child elements between start tag and and end tag defined this fragment
  | 
| 
williamr@2
 | 
    60  | 
* will become content of this BaseFragment. In other words, BaseFragment has
  | 
| 
williamr@2
 | 
    61  | 
* all data inside a single element.
  | 
| 
williamr@2
 | 
    62  | 
* BaseFragment will parse only namespace (xmlns) attributes from a document
  | 
| 
williamr@2
 | 
    63  | 
* and rest of the attributes are to be handled by subclasses, which should
  | 
| 
williamr@2
 | 
    64  | 
* overwrite SetAttributesL() method to achieve this.
  | 
| 
williamr@2
 | 
    65  | 
* The CSenFragmentReader class will do the actual parsing and this class will
  | 
| 
williamr@2
 | 
    66  | 
* act as content handler for XML parser SAX events.
  | 
| 
williamr@2
 | 
    67  | 
* @lib SenFragment.dll
  | 
| 
williamr@2
 | 
    68  | 
* @since Series60 4.0
  | 
| 
williamr@2
 | 
    69  | 
*/
  | 
| 
williamr@2
 | 
    70  | 
class CSenFragmentBase : public CBase, public MContentHandler
  | 
| 
williamr@2
 | 
    71  | 
    {
 | 
| 
williamr@2
 | 
    72  | 
    friend class CSenParserImpl;
  | 
| 
williamr@2
 | 
    73  | 
    
  | 
| 
williamr@2
 | 
    74  | 
    public:  // Constructors and destructor
  | 
| 
williamr@2
 | 
    75  | 
        
  | 
| 
williamr@2
 | 
    76  | 
        /**
  | 
| 
williamr@2
 | 
    77  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
    78  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
    79  | 
         *  @param aElement is the element where construction 
  | 
| 
williamr@2
 | 
    80  | 
         *                  data will be copied from.
  | 
| 
williamr@2
 | 
    81  | 
         */
  | 
| 
williamr@2
 | 
    82  | 
        IMPORT_C static CSenFragmentBase* NewL(const TXmlEngElement& aElement);
  | 
| 
williamr@2
 | 
    83  | 
  | 
| 
williamr@2
 | 
    84  | 
        /**
  | 
| 
williamr@2
 | 
    85  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
    86  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
    87  | 
         *  @param aLocalName: is the XML localname for this fragment
  | 
| 
williamr@2
 | 
    88  | 
         */
  | 
| 
williamr@2
 | 
    89  | 
        IMPORT_C static CSenFragmentBase* NewL(const TDesC8& aLocalName);
  | 
| 
williamr@2
 | 
    90  | 
  | 
| 
williamr@2
 | 
    91  | 
        /**
  | 
| 
williamr@2
 | 
    92  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
    93  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
    94  | 
         *  @param aNsUri:  XML namespace URI
  | 
| 
williamr@2
 | 
    95  | 
         *  @param aLocalName:  XML localname
  | 
| 
williamr@2
 | 
    96  | 
         */
  | 
| 
williamr@2
 | 
    97  | 
        IMPORT_C static CSenFragmentBase* NewL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
    98  | 
                                               const TDesC8& aLocalName);
  | 
| 
williamr@2
 | 
    99  | 
  | 
| 
williamr@2
 | 
   100  | 
        /**
  | 
| 
williamr@2
 | 
   101  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
   102  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
   103  | 
         *  @param aNsUri       XML namespace URI
  | 
| 
williamr@2
 | 
   104  | 
         *  @param aLocalName   XML localname
  | 
| 
williamr@2
 | 
   105  | 
         *  @param aPrefix      XML prefix
  | 
| 
williamr@2
 | 
   106  | 
         */
  | 
| 
williamr@2
 | 
   107  | 
        IMPORT_C static CSenFragmentBase* NewL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   108  | 
                                               const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   109  | 
                                               const TDesC8& aPrefix);
  | 
| 
williamr@2
 | 
   110  | 
  | 
| 
williamr@2
 | 
   111  | 
        /**
  | 
| 
williamr@2
 | 
   112  | 
         * Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
   113  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   114  | 
         * @param aNsUri        XML namespace URI
  | 
| 
williamr@2
 | 
   115  | 
         * @param aLocalName    XML localname
  | 
| 
williamr@2
 | 
   116  | 
         * @param aPrefix       XML prefix
  | 
| 
williamr@2
 | 
   117  | 
         * @param apAttrs       XML attributes
  | 
| 
williamr@2
 | 
   118  | 
         */
  | 
| 
williamr@2
 | 
   119  | 
         IMPORT_C static CSenFragmentBase* NewL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   120  | 
                                                const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   121  | 
                                                const TDesC8& aPrefix,
  | 
| 
williamr@2
 | 
   122  | 
                                                const RAttributeArray& apAttrs);
  | 
| 
williamr@2
 | 
   123  | 
  | 
| 
williamr@2
 | 
   124  | 
        /**
  | 
| 
williamr@2
 | 
   125  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
   126  | 
         *  @param aParent  Element to be set as fragment's parent element.
  | 
| 
williamr@2
 | 
   127  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
   128  | 
         *  @param aNsUri       XML namespace URI
  | 
| 
williamr@2
 | 
   129  | 
         *  @param aLocalName   XML localname
  | 
| 
williamr@2
 | 
   130  | 
         *  @param aPrefix      XML prefix
  | 
| 
williamr@2
 | 
   131  | 
         *  @param apAttrs      XML attributes
  | 
| 
williamr@2
 | 
   132  | 
         *  @param aParent      Parent element
  | 
| 
williamr@2
 | 
   133  | 
         */
  | 
| 
williamr@2
 | 
   134  | 
        IMPORT_C static CSenFragmentBase* NewL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   135  | 
                                               const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   136  | 
                                               const TDesC8& aPrefix,
  | 
| 
williamr@2
 | 
   137  | 
                                               const RAttributeArray& apAttrs,
  | 
| 
williamr@2
 | 
   138  | 
                                               TXmlEngElement& aParent);
  | 
| 
williamr@2
 | 
   139  | 
  | 
| 
williamr@2
 | 
   140  | 
        /**
  | 
| 
williamr@2
 | 
   141  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
   142  | 
         *  @param aParent  Element to be set as fragment's parent element.
  | 
| 
williamr@2
 | 
   143  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
   144  | 
         *  @param aNsUri           XML namespace URI
  | 
| 
williamr@2
 | 
   145  | 
         *  @param aLocalName       XML localname
  | 
| 
williamr@2
 | 
   146  | 
         *  @param aPrefix          XML prefix
  | 
| 
williamr@2
 | 
   147  | 
         *  @param apAttrs          XML attributes
  | 
| 
williamr@2
 | 
   148  | 
         *  @param aParent          Parent element
  | 
| 
williamr@2
 | 
   149  | 
         *  @param aOwnerDocument   The document which will be the owner of
  | 
| 
williamr@2
 | 
   150  | 
         *                          the elements of this fragment
  | 
| 
williamr@2
 | 
   151  | 
         */
  | 
| 
williamr@2
 | 
   152  | 
        IMPORT_C static CSenFragmentBase* NewL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   153  | 
                                               const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   154  | 
                                               const TDesC8& aPrefix,
  | 
| 
williamr@2
 | 
   155  | 
                                               const RAttributeArray& apAttrs,
  | 
| 
williamr@2
 | 
   156  | 
                                               TXmlEngElement& aParent,
  | 
| 
williamr@2
 | 
   157  | 
                                               RSenDocument& aOwnerDocument);
  | 
| 
williamr@2
 | 
   158  | 
  | 
| 
williamr@2
 | 
   159  | 
        /**
  | 
| 
williamr@2
 | 
   160  | 
         *  Standard 2 phase constructor.
  | 
| 
williamr@2
 | 
   161  | 
         *  @param aParent  Element to be set as fragment's parent element.
  | 
| 
williamr@2
 | 
   162  | 
         *  @since Series60 4.0
  | 
| 
williamr@2
 | 
   163  | 
         *  @param aRootElement     The element which will be the root element
  | 
| 
williamr@2
 | 
   164  | 
         *                          of this fragment.
  | 
| 
williamr@2
 | 
   165  | 
         *  @param aOwnerDocument   The document which will be the owner of
  | 
| 
williamr@2
 | 
   166  | 
         *                          the elements of this fragment
  | 
| 
williamr@2
 | 
   167  | 
         */
  | 
| 
williamr@2
 | 
   168  | 
        IMPORT_C static CSenFragmentBase* NewL(TXmlEngElement& aRootElement,
  | 
| 
williamr@2
 | 
   169  | 
                                               RSenDocument& aOwnerDocument);
  | 
| 
williamr@2
 | 
   170  | 
  | 
| 
williamr@2
 | 
   171  | 
        /**
  | 
| 
williamr@2
 | 
   172  | 
         * Destructor.
  | 
| 
williamr@2
 | 
   173  | 
         */
  | 
| 
williamr@2
 | 
   174  | 
        IMPORT_C virtual ~CSenFragmentBase();
  | 
| 
williamr@2
 | 
   175  | 
  | 
| 
williamr@2
 | 
   176  | 
        // Functions from base classes
  | 
| 
williamr@2
 | 
   177  | 
        
  | 
| 
williamr@2
 | 
   178  | 
        // From MContentHandler:
  | 
| 
williamr@2
 | 
   179  | 
        
  | 
| 
williamr@2
 | 
   180  | 
        /**
  | 
| 
williamr@2
 | 
   181  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   182  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   183  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   184  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   185  | 
         */
  | 
| 
williamr@2
 | 
   186  | 
    	IMPORT_C virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   187  | 
  | 
| 
williamr@2
 | 
   188  | 
        /**
  | 
| 
williamr@2
 | 
   189  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   190  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   191  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   192  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   193  | 
         */
  | 
| 
williamr@2
 | 
   194  | 
        IMPORT_C virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   195  | 
  | 
| 
williamr@2
 | 
   196  | 
        /**
  | 
| 
williamr@2
 | 
   197  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   198  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   199  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   200  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   201  | 
         */
  | 
| 
williamr@2
 | 
   202  | 
    	IMPORT_C virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   203  | 
  | 
| 
williamr@2
 | 
   204  | 
        /**
  | 
| 
williamr@2
 | 
   205  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   206  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   207  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   208  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   209  | 
         */
  | 
| 
williamr@2
 | 
   210  | 
    	IMPORT_C virtual void OnEndDocumentL(TInt aErrorCode);
  | 
| 
williamr@2
 | 
   211  | 
  | 
| 
williamr@2
 | 
   212  | 
        /**
  | 
| 
williamr@2
 | 
   213  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   214  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   215  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   216  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   217  | 
         */
  | 
| 
williamr@2
 | 
   218  | 
    	IMPORT_C virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   219  | 
  | 
| 
williamr@2
 | 
   220  | 
        /**
  | 
| 
williamr@2
 | 
   221  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   222  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   223  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   224  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   225  | 
         */
  | 
| 
williamr@2
 | 
   226  | 
    	IMPORT_C virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   227  | 
  | 
| 
williamr@2
 | 
   228  | 
        /**
  | 
| 
williamr@2
 | 
   229  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   230  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   231  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   232  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   233  | 
         */
  | 
| 
williamr@2
 | 
   234  | 
    	IMPORT_C virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   235  | 
  | 
| 
williamr@2
 | 
   236  | 
        /**
  | 
| 
williamr@2
 | 
   237  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   238  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   239  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   240  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   241  | 
         */
  | 
| 
williamr@2
 | 
   242  | 
    	IMPORT_C virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt ErrorCode);
  | 
| 
williamr@2
 | 
   243  | 
  | 
| 
williamr@2
 | 
   244  | 
        /**
  | 
| 
williamr@2
 | 
   245  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   246  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   247  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   248  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   249  | 
         */
  | 
| 
williamr@2
 | 
   250  | 
    	IMPORT_C virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   251  | 
  | 
| 
williamr@2
 | 
   252  | 
        /**
  | 
| 
williamr@2
 | 
   253  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   254  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   255  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   256  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   257  | 
         */
  | 
| 
williamr@2
 | 
   258  | 
    	IMPORT_C virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   259  | 
  | 
| 
williamr@2
 | 
   260  | 
        /**
  | 
| 
williamr@2
 | 
   261  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   262  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   263  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   264  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   265  | 
         */
  | 
| 
williamr@2
 | 
   266  | 
    	IMPORT_C virtual void OnError(TInt aErrorCode);
  | 
| 
williamr@2
 | 
   267  | 
  | 
| 
williamr@2
 | 
   268  | 
        /**
  | 
| 
williamr@2
 | 
   269  | 
         * Callback function implementing the XML content handler interface.
  | 
| 
williamr@2
 | 
   270  | 
         * Inheriting classes can override these.
  | 
| 
williamr@2
 | 
   271  | 
         * @since Series60 3.1
  | 
| 
williamr@2
 | 
   272  | 
         * @see MContentHandler
  | 
| 
williamr@2
 | 
   273  | 
         */
  | 
| 
williamr@2
 | 
   274  | 
    	IMPORT_C virtual TAny* GetExtendedInterface(const TInt32 aUid);
  | 
| 
williamr@2
 | 
   275  | 
  | 
| 
williamr@2
 | 
   276  | 
        // New functions
  | 
| 
williamr@2
 | 
   277  | 
    
  | 
| 
williamr@2
 | 
   278  | 
        /**
  | 
| 
williamr@2
 | 
   279  | 
         * Getter for the content,which is returned as UTF-8 form XML.
  | 
| 
williamr@2
 | 
   280  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   281  | 
         * @return content as UTF-8 form XML.
  | 
| 
williamr@2
 | 
   282  | 
         */
  | 
| 
williamr@2
 | 
   283  | 
        IMPORT_C virtual TPtrC8 ContentL();
  | 
| 
williamr@2
 | 
   284  | 
        
  | 
| 
williamr@2
 | 
   285  | 
        /**
  | 
| 
williamr@2
 | 
   286  | 
         * Gets the namespace object with a given prefix.
  | 
| 
williamr@2
 | 
   287  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   288  | 
         * @param   aPrefix:    prefix that wanted namespace should have.
  | 
| 
williamr@2
 | 
   289  | 
         * @return namespace with the given prefix. If not found or given prefix
  | 
| 
williamr@2
 | 
   290  | 
         * is zero length, will return NULL.
  | 
| 
williamr@2
 | 
   291  | 
         */
  | 
| 
williamr@2
 | 
   292  | 
        IMPORT_C virtual TXmlEngNamespace Namespace(const TDesC8& aPrefix);
  | 
| 
williamr@2
 | 
   293  | 
        
  | 
| 
williamr@2
 | 
   294  | 
        /**
  | 
| 
williamr@2
 | 
   295  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   296  | 
         * @return Detaches this fragment from its owner. All namespace
  | 
| 
williamr@2
 | 
   297  | 
         * references from possible parent fragments are declared in
  | 
| 
williamr@2
 | 
   298  | 
         * the scope of this fragment prior detaching.
  | 
| 
williamr@2
 | 
   299  | 
         */
  | 
| 
williamr@2
 | 
   300  | 
//        IMPORT_C virtual void DetachL();
  | 
| 
williamr@2
 | 
   301  | 
        
  | 
| 
williamr@2
 | 
   302  | 
        /**
  | 
| 
williamr@2
 | 
   303  | 
         * Resets the content of the fragment, and resets the namespaces.
  | 
| 
williamr@2
 | 
   304  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   305  | 
         */
  | 
| 
williamr@2
 | 
   306  | 
        IMPORT_C virtual void ResetContentL();
  | 
| 
williamr@2
 | 
   307  | 
  | 
| 
williamr@2
 | 
   308  | 
        /** 
  | 
| 
williamr@2
 | 
   309  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   310  | 
         * @return the localname of this fragment as UTF-8 form descriptor
  | 
| 
williamr@2
 | 
   311  | 
         */
  | 
| 
williamr@2
 | 
   312  | 
        IMPORT_C virtual TPtrC8 LocalName() const;
  | 
| 
williamr@2
 | 
   313  | 
        
  | 
| 
williamr@2
 | 
   314  | 
        /**
  | 
| 
williamr@2
 | 
   315  | 
         * Getter for Fragment's namespace URI..
  | 
| 
williamr@2
 | 
   316  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   317  | 
         * @return Namespace URI or KNullDesC if not set.
  | 
| 
williamr@2
 | 
   318  | 
         */
  | 
| 
williamr@2
 | 
   319  | 
        IMPORT_C virtual TPtrC8 NsUri() const;
  | 
| 
williamr@2
 | 
   320  | 
  | 
| 
williamr@2
 | 
   321  | 
        /**
  | 
| 
williamr@2
 | 
   322  | 
         * Getter for namespace prefix of this fragment.
  | 
| 
williamr@2
 | 
   323  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   324  | 
         * @return namespace prefix or KNullDesC if not set.
  | 
| 
williamr@2
 | 
   325  | 
         */
  | 
| 
williamr@2
 | 
   326  | 
        IMPORT_C virtual TPtrC8 NsPrefix() const;    
  | 
| 
williamr@2
 | 
   327  | 
  | 
| 
williamr@2
 | 
   328  | 
        /**
  | 
| 
williamr@2
 | 
   329  | 
        * Returns the current XML element of this fragment. If element
  | 
| 
williamr@2
 | 
   330  | 
        * has not been set, this method will initialize new, un-initialized
  | 
| 
williamr@2
 | 
   331  | 
        * element.
  | 
| 
williamr@2
 | 
   332  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   333  | 
        * @return reference to the element of this fragment
  | 
| 
williamr@2
 | 
   334  | 
        */
  | 
| 
williamr@2
 | 
   335  | 
        IMPORT_C virtual TXmlEngElement AsElementL();
  | 
| 
williamr@2
 | 
   336  | 
  | 
| 
williamr@2
 | 
   337  | 
        /**
  | 
| 
williamr@2
 | 
   338  | 
        * Returns the current XML element of this fragment. If element
  | 
| 
williamr@2
 | 
   339  | 
        * has not been set, this method will initialize new, un-initialized
  | 
| 
williamr@2
 | 
   340  | 
        * element.
  | 
| 
williamr@2
 | 
   341  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   342  | 
        * @return reference to the element of this fragment
  | 
| 
williamr@2
 | 
   343  | 
        */
  | 
| 
williamr@2
 | 
   344  | 
        IMPORT_C virtual RSenDocument& AsDocumentL();
  | 
| 
williamr@2
 | 
   345  | 
  | 
| 
williamr@2
 | 
   346  | 
        /**
  | 
| 
williamr@2
 | 
   347  | 
         * Etracts the XML element from the fragment, leaving the fragment empty.
  | 
| 
williamr@2
 | 
   348  | 
         * Note(!): the return value (CSenElement) STRONGLY suggests that
  | 
| 
williamr@2
 | 
   349  | 
         * subclasses INHERIT CSenFragment in order properly comply the
  | 
| 
williamr@2
 | 
   350  | 
         * requirement of the ExtractElement() implementation.
  | 
| 
williamr@2
 | 
   351  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   352  | 
         * @return the current object as element. May return NULL.
  | 
| 
williamr@2
 | 
   353  | 
         * Ownership IS TRANSFERRED to the caller.
  | 
| 
williamr@2
 | 
   354  | 
         */
  | 
| 
williamr@2
 | 
   355  | 
        IMPORT_C virtual TXmlEngElement ExtractElement();
  | 
| 
williamr@2
 | 
   356  | 
        
  | 
| 
williamr@2
 | 
   357  | 
        /**
  | 
| 
williamr@2
 | 
   358  | 
         * Let the delegate MSenFragment handle the following SAX events.
  | 
| 
williamr@2
 | 
   359  | 
         * This fragment is made the owner of the delegate and the delegate
  | 
| 
williamr@2
 | 
   360  | 
         * is expected to make this MSenFragment the receiver of SAX events
  | 
| 
williamr@2
 | 
   361  | 
         * once it has seen the end element for itself.
  | 
| 
williamr@2
 | 
   362  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   363  | 
         * @param aDelegate is the fragment to start handling the SAX events.
  | 
| 
williamr@2
 | 
   364  | 
         */
  | 
| 
williamr@2
 | 
   365  | 
        IMPORT_C virtual void OnDelegateParsingL(CSenFragmentBase& aDelegate);
  | 
| 
williamr@2
 | 
   366  | 
  | 
| 
williamr@2
 | 
   367  | 
        /**
  | 
| 
williamr@2
 | 
   368  | 
         * Creates a new fragment and lets the created MSenFragment handle the 
  | 
| 
williamr@2
 | 
   369  | 
         * following SAX events. This fragment is made the owner of the delegate
  | 
| 
williamr@2
 | 
   370  | 
         * and the delegate is expected to make this MSenFragment act as receiver
  | 
| 
williamr@2
 | 
   371  | 
         * for SAX events (callbacks) once it has seen the end element for itself.
  | 
| 
williamr@2
 | 
   372  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   373  | 
         * @param aElement      The RTagInfo class holding information that
  | 
| 
williamr@2
 | 
   374  | 
         *                      describes the element.
  | 
| 
williamr@2
 | 
   375  | 
         * @param aAttributes   The attributes of the new element
  | 
| 
williamr@2
 | 
   376  | 
         * @param aErrorCode    Error code
  | 
| 
williamr@2
 | 
   377  | 
         */
  | 
| 
williamr@2
 | 
   378  | 
        IMPORT_C virtual void OnDelegateParsingL(const RTagInfo& aElement, 
  | 
| 
williamr@2
 | 
   379  | 
                                                 const RAttributeArray& aAttributes, 
  | 
| 
williamr@2
 | 
   380  | 
                                                 TInt aErrorCode);
  | 
| 
williamr@2
 | 
   381  | 
        
  | 
| 
williamr@2
 | 
   382  | 
        /**
  | 
| 
williamr@2
 | 
   383  | 
         * Sets a new parent for this fragment.
  | 
| 
williamr@2
 | 
   384  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   385  | 
         * @param aFragment:    the new parent.
  | 
| 
williamr@2
 | 
   386  | 
         */
  | 
| 
williamr@2
 | 
   387  | 
        IMPORT_C virtual void SetOwner(CSenFragmentBase& aFragment);
  | 
| 
williamr@2
 | 
   388  | 
  | 
| 
williamr@2
 | 
   389  | 
        /**
  | 
| 
williamr@2
 | 
   390  | 
         * Leave codes: 
  | 
| 
williamr@2
 | 
   391  | 
         * Resumes parsing to be handled by this fragment. Usually called by some
  | 
| 
williamr@2
 | 
   392  | 
         * delegate fragment which was set to be content handler because this
  | 
| 
williamr@2
 | 
   393  | 
         * fragment called DelegateParsingL().
  | 
| 
williamr@2
 | 
   394  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   395  | 
         * @param aElement      The RTagInfo class holding information that
  | 
| 
williamr@2
 | 
   396  | 
         *                      describes the element.
  | 
| 
williamr@2
 | 
   397  | 
         * @param aErrorCode    Error code
  | 
| 
williamr@2
 | 
   398  | 
         */
  | 
| 
williamr@2
 | 
   399  | 
        IMPORT_C virtual void OnResumeParsingFromL(const RTagInfo& aElement, TInt aErrorCode);
  | 
| 
williamr@2
 | 
   400  | 
  | 
| 
williamr@2
 | 
   401  | 
        /**
  | 
| 
williamr@2
 | 
   402  | 
         * Sets the attributes for the fragment. BaseFragment parses only
  | 
| 
williamr@2
 | 
   403  | 
         * namespace (xmlns) attributes from the document.
  | 
| 
williamr@2
 | 
   404  | 
         * Subclasses should override this method if they are intrested
  | 
| 
williamr@2
 | 
   405  | 
         * of handling any other XML attributes and their corresponding
  | 
| 
williamr@2
 | 
   406  | 
         * values.
  | 
| 
williamr@2
 | 
   407  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   408  | 
         * @param aAttrs:   the array of attributes.
  | 
| 
williamr@2
 | 
   409  | 
         */
  | 
| 
williamr@2
 | 
   410  | 
//        IMPORT_C virtual void SetAttributesL(const RAttributeArray& aAttrs);
  | 
| 
williamr@2
 | 
   411  | 
        
  | 
| 
williamr@2
 | 
   412  | 
        /**
  | 
| 
williamr@2
 | 
   413  | 
         * Writes the start element tag to the content stream. 
  | 
| 
williamr@2
 | 
   414  | 
         * Derivants can override the basic usage used in BaseFragment.
  | 
| 
williamr@2
 | 
   415  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   416  | 
         * @param aElement      The RTagInfo class holding information that
  | 
| 
williamr@2
 | 
   417  | 
         *                      describes the element.
  | 
| 
williamr@2
 | 
   418  | 
         * @param aAttributes   The attributes of the new element
  | 
| 
williamr@2
 | 
   419  | 
         */
  | 
| 
williamr@2
 | 
   420  | 
        IMPORT_C void OnWriteStartElementL(const RTagInfo& aElement, 
  | 
| 
williamr@2
 | 
   421  | 
                                           const RAttributeArray& aAttributes);
  | 
| 
williamr@2
 | 
   422  | 
        
  | 
| 
williamr@2
 | 
   423  | 
        /**
  | 
| 
williamr@2
 | 
   424  | 
         * Writes the end element tag to the content stream. 
  | 
| 
williamr@2
 | 
   425  | 
         * Derivants can override the basic usage used in BaseFragment.
  | 
| 
williamr@2
 | 
   426  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   427  | 
         * @param aElement      The RTagInfo class holding information that
  | 
| 
williamr@2
 | 
   428  | 
         *                      describes the element.
  | 
| 
williamr@2
 | 
   429  | 
         */
  | 
| 
williamr@2
 | 
   430  | 
        IMPORT_C void OnWriteEndElementL(const RTagInfo& aElement);
  | 
| 
williamr@2
 | 
   431  | 
  | 
| 
williamr@2
 | 
   432  | 
        /**
  | 
| 
williamr@2
 | 
   433  | 
         * Gets the fragment data as an unicode XML.
  | 
| 
williamr@2
 | 
   434  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   435  | 
         * @return  fragment as XML. Caller takes ownership.
  | 
| 
williamr@2
 | 
   436  | 
         */ 
  | 
| 
williamr@2
 | 
   437  | 
        IMPORT_C virtual HBufC* AsXmlUnicodeL();
  | 
| 
williamr@2
 | 
   438  | 
  | 
| 
williamr@2
 | 
   439  | 
        /**
  | 
| 
williamr@2
 | 
   440  | 
         * Gets the fragment data as an UTF-8 form XML.
  | 
| 
williamr@2
 | 
   441  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   442  | 
         * @return  fragment as XML. Caller takes ownership.
  | 
| 
williamr@2
 | 
   443  | 
         */ 
  | 
| 
williamr@2
 | 
   444  | 
        IMPORT_C virtual HBufC8* AsXmlL();
  | 
| 
williamr@2
 | 
   445  | 
  | 
| 
williamr@2
 | 
   446  | 
        /**
  | 
| 
williamr@2
 | 
   447  | 
         * Invokes AsElement().WriteAsXMLToL(aWs);
  | 
| 
williamr@2
 | 
   448  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   449  | 
         * @param aWs is the stream into which the UTF-8 form XML will
  | 
| 
williamr@2
 | 
   450  | 
         *            be written.
  | 
| 
williamr@2
 | 
   451  | 
         */
  | 
| 
williamr@2
 | 
   452  | 
        IMPORT_C virtual void WriteAsXMLToL(RWriteStream& aWs);
  | 
| 
williamr@2
 | 
   453  | 
  | 
| 
williamr@2
 | 
   454  | 
        /**
  | 
| 
williamr@2
 | 
   455  | 
         * Checks if fragment matches to another fragment 
  | 
| 
williamr@2
 | 
   456  | 
         * by its content and child elements. 
  | 
| 
williamr@2
 | 
   457  | 
         * Fragment can contain more data than the given candidate.
  | 
| 
williamr@2
 | 
   458  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   459  | 
         * @param aCandidate    The pattern to be matched. Must contain same or 
  | 
| 
williamr@2
 | 
   460  | 
         *                      less data for match to come true.
  | 
| 
williamr@2
 | 
   461  | 
         * @return ETrue if content and possible children match exactly 
  | 
| 
williamr@2
 | 
   462  | 
         *               to given pattern. EFalse otherwise.
  | 
| 
williamr@2
 | 
   463  | 
         */
  | 
| 
williamr@2
 | 
   464  | 
        IMPORT_C virtual TBool ConsistsOfL(CSenFragmentBase& aCandidate);
  | 
| 
williamr@2
 | 
   465  | 
        
  | 
| 
williamr@2
 | 
   466  | 
        //From SenParserImpl.h
  | 
| 
williamr@2
 | 
   467  | 
        IMPORT_C void SetContentHandler(CSenFragmentBase& aContentHandler);
  | 
| 
williamr@2
 | 
   468  | 
        
  | 
| 
williamr@2
 | 
   469  | 
        /**
  | 
| 
williamr@2
 | 
   470  | 
        * Sets the RSenDocument
  | 
| 
williamr@2
 | 
   471  | 
        * @param aDocument
  | 
| 
williamr@2
 | 
   472  | 
        */
  | 
| 
williamr@2
 | 
   473  | 
        IMPORT_C void SetDocument(RSenDocument& aDocument);
  | 
| 
williamr@2
 | 
   474  | 
  | 
| 
williamr@2
 | 
   475  | 
    protected:  
  | 
| 
williamr@2
 | 
   476  | 
        
  | 
| 
williamr@2
 | 
   477  | 
        /**
  | 
| 
williamr@2
 | 
   478  | 
        * C++ default constructor.
  | 
| 
williamr@2
 | 
   479  | 
        */
  | 
| 
williamr@2
 | 
   480  | 
        IMPORT_C CSenFragmentBase();        
  | 
| 
williamr@2
 | 
   481  | 
        
  | 
| 
williamr@2
 | 
   482  | 
        /**
  | 
| 
williamr@2
 | 
   483  | 
         * Following BaseConstructL methods should be called from ConstructL() 
  | 
| 
williamr@2
 | 
   484  | 
         * methods of some deriving (fragment) class.
  | 
| 
williamr@2
 | 
   485  | 
         */
  | 
| 
williamr@2
 | 
   486  | 
  | 
| 
williamr@2
 | 
   487  | 
        /**
  | 
| 
williamr@2
 | 
   488  | 
        * BaseConstructL, where an element is given as initializer.
  | 
| 
williamr@2
 | 
   489  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   490  | 
        * @param aElement from which this fragment will be constructed from.
  | 
| 
williamr@2
 | 
   491  | 
        */
  | 
| 
williamr@2
 | 
   492  | 
        IMPORT_C void BaseConstructL(const TXmlEngElement& aSrc);
  | 
| 
williamr@2
 | 
   493  | 
        
  | 
| 
williamr@2
 | 
   494  | 
        /**
  | 
| 
williamr@2
 | 
   495  | 
        * BaseConstructL setting XML localname for this fragment.
  | 
| 
williamr@2
 | 
   496  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   497  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   498  | 
        */
  | 
| 
williamr@2
 | 
   499  | 
        IMPORT_C void BaseConstructL(const TDesC8& aLocalName);
  | 
| 
williamr@2
 | 
   500  | 
  | 
| 
williamr@2
 | 
   501  | 
        /**
  | 
| 
williamr@2
 | 
   502  | 
        * BaseConstructL offering possibility to set XML namespace and localname.
  | 
| 
williamr@2
 | 
   503  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   504  | 
        * @param aNsUri XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   505  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   506  | 
        */
  | 
| 
williamr@2
 | 
   507  | 
        IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   508  | 
                                     const TDesC8& aLocalName);
  | 
| 
williamr@2
 | 
   509  | 
  | 
| 
williamr@2
 | 
   510  | 
        /**
  | 
| 
williamr@2
 | 
   511  | 
        * Base constructor
  | 
| 
williamr@2
 | 
   512  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   513  | 
        * @param aNsUri XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   514  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   515  | 
        * @param aQName XML qualifiedname for this fragment
  | 
| 
williamr@2
 | 
   516  | 
        */
  | 
| 
williamr@2
 | 
   517  | 
        IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   518  | 
                                     const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   519  | 
                                     const TDesC8& aPrefix);
  | 
| 
williamr@2
 | 
   520  | 
        /**
  | 
| 
williamr@2
 | 
   521  | 
        * Base constructor
  | 
| 
williamr@2
 | 
   522  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   523  | 
        * @param aNsUri XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   524  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   525  | 
        * @param aQName XML qualifiedname for this fragment
  | 
| 
williamr@2
 | 
   526  | 
        * @param aAttrs XML attributes for this fragment
  | 
| 
williamr@2
 | 
   527  | 
        */
  | 
| 
williamr@2
 | 
   528  | 
        IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   529  | 
                                     const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   530  | 
                                     const TDesC8& aPrefix,
  | 
| 
williamr@2
 | 
   531  | 
                                     const RAttributeArray& aAttrs);
  | 
| 
williamr@2
 | 
   532  | 
  | 
| 
williamr@2
 | 
   533  | 
        /**
  | 
| 
williamr@2
 | 
   534  | 
        * Base constructor
  | 
| 
williamr@2
 | 
   535  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   536  | 
        * @param aNsUri XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   537  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   538  | 
        * @param aQName XML qualifiedname for this fragment
  | 
| 
williamr@2
 | 
   539  | 
        * @param aAttrs XML attributes for this fragment
  | 
| 
williamr@2
 | 
   540  | 
        * @param aParent parent to be set for this fragmemt
  | 
| 
williamr@2
 | 
   541  | 
        */
  | 
| 
williamr@2
 | 
   542  | 
        IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   543  | 
                                     const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   544  | 
                                     const TDesC8& aPrefix,
  | 
| 
williamr@2
 | 
   545  | 
                                     const RAttributeArray& aAttrs,
  | 
| 
williamr@2
 | 
   546  | 
                                     TXmlEngElement& aParent);
  | 
| 
williamr@2
 | 
   547  | 
  | 
| 
williamr@2
 | 
   548  | 
        /**
  | 
| 
williamr@2
 | 
   549  | 
        * Base constructor
  | 
| 
williamr@2
 | 
   550  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   551  | 
        * @param aNsUri         XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   552  | 
        * @param aLocalName     XML localname for this fragment
  | 
| 
williamr@2
 | 
   553  | 
        * @param aQName         XML qualifiedname for this fragment
  | 
| 
williamr@2
 | 
   554  | 
        * @param aAttrs         XML attributes for this fragment
  | 
| 
williamr@2
 | 
   555  | 
        * @param aParent        Parent to be set for this fragmemt
  | 
| 
williamr@2
 | 
   556  | 
        * @param aOwnerDocument The document which will be the owner of
  | 
| 
williamr@2
 | 
   557  | 
        *                       the elements of this fragment
  | 
| 
williamr@2
 | 
   558  | 
        */
  | 
| 
williamr@2
 | 
   559  | 
        IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
  | 
| 
williamr@2
 | 
   560  | 
                                     const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   561  | 
                                     const TDesC8& aPrefix,
  | 
| 
williamr@2
 | 
   562  | 
                                     const RAttributeArray& aAttrs,
  | 
| 
williamr@2
 | 
   563  | 
                                     TXmlEngElement& aParent,
  | 
| 
williamr@2
 | 
   564  | 
                                     RSenDocument& aOwnerDocument);
  | 
| 
williamr@2
 | 
   565  | 
        
  | 
| 
williamr@2
 | 
   566  | 
        /**
  | 
| 
williamr@2
 | 
   567  | 
        * Base constructor
  | 
| 
williamr@2
 | 
   568  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   569  | 
        * @param aRootElement   The element which will be the root element
  | 
| 
williamr@2
 | 
   570  | 
        *                       of this fragment
  | 
| 
williamr@2
 | 
   571  | 
        * @param aOwnerDocument The document which will be the owner of
  | 
| 
williamr@2
 | 
   572  | 
        *                       the elements of this fragment
  | 
| 
williamr@2
 | 
   573  | 
        */
  | 
| 
williamr@2
 | 
   574  | 
        IMPORT_C void BaseConstructL(TXmlEngElement& aRootElement,
  | 
| 
williamr@2
 | 
   575  | 
                                     RSenDocument& aOwnerDocument);
  | 
| 
williamr@2
 | 
   576  | 
        
  | 
| 
williamr@2
 | 
   577  | 
        // New functions
  | 
| 
williamr@2
 | 
   578  | 
  | 
| 
williamr@2
 | 
   579  | 
        /**
  | 
| 
williamr@2
 | 
   580  | 
        *  Adds new XML attributes to this fragment.
  | 
| 
williamr@2
 | 
   581  | 
        *  Can be overridden to replace old attributes.
  | 
| 
williamr@2
 | 
   582  | 
        *  @param  aAttrs: the array of attributes.
  | 
| 
williamr@2
 | 
   583  | 
        */
  | 
| 
williamr@2
 | 
   584  | 
        IMPORT_C virtual void AddAttributesL(const RAttributeArray& apAttrs);
  | 
| 
williamr@2
 | 
   585  | 
  | 
| 
williamr@2
 | 
   586  | 
        /**
  | 
| 
williamr@2
 | 
   587  | 
        *  Adds new XML attributes to specified element.
  | 
| 
williamr@2
 | 
   588  | 
        *  Can be overridden to replace old attributes.
  | 
| 
williamr@2
 | 
   589  | 
        *  @param  aAttrs: the array of attributes.
  | 
| 
williamr@2
 | 
   590  | 
        */
  | 
| 
williamr@2
 | 
   591  | 
        IMPORT_C virtual void AddAttributesToElementL(TXmlEngElement element,
  | 
| 
williamr@2
 | 
   592  | 
                                         const RAttributeArray& apAttrs);
  | 
| 
williamr@2
 | 
   593  | 
        
  | 
| 
williamr@2
 | 
   594  | 
        /** 
  | 
| 
williamr@2
 | 
   595  | 
        * Method renames the XML properties of this fragment.
  | 
| 
williamr@2
 | 
   596  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   597  | 
        * @param aPrefix XML namespace prefix for this fragment
  | 
| 
williamr@2
 | 
   598  | 
        * @param aNamespace XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   599  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   600  | 
        */
  | 
| 
williamr@2
 | 
   601  | 
        void RenameL(const TDesC8& aLocalName, const TDesC8& aPrefix, const TDesC8& aNamespace);
  | 
| 
williamr@2
 | 
   602  | 
  | 
| 
williamr@2
 | 
   603  | 
        /** 
  | 
| 
williamr@2
 | 
   604  | 
        * Method renames the XML properties of this fragment.
  | 
| 
williamr@2
 | 
   605  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   606  | 
        * @param aNamespace XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   607  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   608  | 
        */
  | 
| 
williamr@2
 | 
   609  | 
        void RenameL(const TDesC8& aLocalName, const TDesC8& aNamespace);
  | 
| 
williamr@2
 | 
   610  | 
  | 
| 
williamr@2
 | 
   611  | 
        /** 
  | 
| 
williamr@2
 | 
   612  | 
        * Renames local name for this XML fragment.
  | 
| 
williamr@2
 | 
   613  | 
        * @param aLocalName XML localname for this fragment
  | 
| 
williamr@2
 | 
   614  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   615  | 
        */
  | 
| 
williamr@2
 | 
   616  | 
        void RenameLocalNameL(const TDesC8& aLocalName);
  | 
| 
williamr@2
 | 
   617  | 
  | 
| 
williamr@2
 | 
   618  | 
        /** 
  | 
| 
williamr@2
 | 
   619  | 
        * Renames namespace URI for this XML fragment.
  | 
| 
williamr@2
 | 
   620  | 
        * @param aNamespace XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   621  | 
        * Method leaves with if there is not enough memory(OOM)
  | 
| 
williamr@2
 | 
   622  | 
        */
  | 
| 
williamr@2
 | 
   623  | 
        void RenameNamespaceL(const TDesC8& aNamespace);
  | 
| 
williamr@2
 | 
   624  | 
  | 
| 
williamr@2
 | 
   625  | 
        /** 
  | 
| 
williamr@2
 | 
   626  | 
        * Renames namespace prefix for this XML fragment.
  | 
| 
williamr@2
 | 
   627  | 
        * @param aPrefix XML namespace prefix for this fragment
  | 
| 
williamr@2
 | 
   628  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   629  | 
        */
  | 
| 
williamr@2
 | 
   630  | 
        void RenamePrefixL(const TDesC8& aPrefix);
  | 
| 
williamr@2
 | 
   631  | 
  | 
| 
williamr@2
 | 
   632  | 
        /** 
  | 
| 
williamr@2
 | 
   633  | 
        * Renames namespace prefix and namespace URI for this XML fragment.
  | 
| 
williamr@2
 | 
   634  | 
        * @param aPrefix XML namespace prefix for this fragment
  | 
| 
williamr@2
 | 
   635  | 
        * @param aNamespace XML namespace URI for this fragment
  | 
| 
williamr@2
 | 
   636  | 
        * Method leaves with if there is not enough memory (OOM)
  | 
| 
williamr@2
 | 
   637  | 
        */
  | 
| 
williamr@2
 | 
   638  | 
        void RenameNamespaceL(const TDesC8& aPrefix, const TDesC8& aNamespace);
  | 
| 
williamr@2
 | 
   639  | 
         
  | 
| 
williamr@2
 | 
   640  | 
        /**
  | 
| 
williamr@2
 | 
   641  | 
         * Sets content to a child element. If no element with given local name
  | 
| 
williamr@2
 | 
   642  | 
         * is not found, new one is added and content is set to that one.
  | 
| 
williamr@2
 | 
   643  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   644  | 
         * @param aLocalName    The local name of element which content
  | 
| 
williamr@2
 | 
   645  | 
         *                      is about to be set
  | 
| 
williamr@2
 | 
   646  | 
         * @param aContent      Content to be set.
  | 
| 
williamr@2
 | 
   647  | 
         * @return              the element where content was set.
  | 
| 
williamr@2
 | 
   648  | 
         * Leave codes: 
  | 
| 
williamr@2
 | 
   649  | 
         *      KErrSenInvalidCharacters if aLocalName contains illegal characters.     
  | 
| 
williamr@2
 | 
   650  | 
         *      KErrSenZeroLengthDescriptor if aLocalName is zero length.
  | 
| 
williamr@2
 | 
   651  | 
         */
  | 
| 
williamr@2
 | 
   652  | 
        IMPORT_C TXmlEngElement SetContentOfL(const TDesC8& aLocalName,
  | 
| 
williamr@2
 | 
   653  | 
                                              const TDesC8& aContent);
  | 
| 
williamr@2
 | 
   654  | 
        /**
  | 
| 
williamr@2
 | 
   655  | 
         * Gets the content of a given element.
  | 
| 
williamr@2
 | 
   656  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   657  | 
         * @param aLocalName    The local name of the element which content is 
  | 
| 
williamr@2
 | 
   658  | 
         *                      asked
  | 
| 
williamr@2
 | 
   659  | 
         * @return  the content which was asked
  | 
| 
williamr@2
 | 
   660  | 
         */
  | 
| 
williamr@2
 | 
   661  | 
        IMPORT_C TPtrC8 ContentOf(const TDesC8& aLocalName);        
  | 
| 
williamr@2
 | 
   662  | 
  | 
| 
williamr@2
 | 
   663  | 
        IMPORT_C virtual TBool ConsistsOfL(TXmlEngElement& aElement, TXmlEngElement& aCandidate);
  | 
| 
williamr@2
 | 
   664  | 
        
  | 
| 
williamr@2
 | 
   665  | 
        /**
  | 
| 
williamr@2
 | 
   666  | 
        * Adds namespaces from internal array for the fragment.
  | 
| 
williamr@2
 | 
   667  | 
        * @since Series60 4.0
  | 
| 
williamr@2
 | 
   668  | 
        */
  | 
| 
williamr@2
 | 
   669  | 
        IMPORT_C virtual void AddNamespacesL();
  | 
| 
williamr@2
 | 
   670  | 
        
  | 
| 
williamr@2
 | 
   671  | 
        /**
  | 
| 
williamr@2
 | 
   672  | 
         * Sets content to a child element. If no element with given local name
  | 
| 
williamr@2
 | 
   673  | 
         * is not found, new one is added and content is set to that one.
  | 
| 
williamr@2
 | 
   674  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   675  | 
         * @param aContent      Content to be set.
  | 
| 
williamr@2
 | 
   676  | 
         */        
  | 
| 
williamr@2
 | 
   677  | 
        IMPORT_C virtual void SetContentL(const TDesC8& aContent);
  | 
| 
williamr@2
 | 
   678  | 
        
  | 
| 
williamr@2
 | 
   679  | 
        /**
  | 
| 
williamr@2
 | 
   680  | 
         * Adds the content. 
  | 
| 
williamr@2
 | 
   681  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   682  | 
         * @param aContent      Content to be set.
  | 
| 
williamr@2
 | 
   683  | 
         */                
  | 
| 
williamr@2
 | 
   684  | 
        IMPORT_C virtual void AddContentL(const TDesC8& aContent);        
  | 
| 
williamr@2
 | 
   685  | 
        
  | 
| 
williamr@2
 | 
   686  | 
        /**
  | 
| 
williamr@2
 | 
   687  | 
        * StartSavingContent changes the internal SAX parsing state of
  | 
| 
williamr@2
 | 
   688  | 
        * this fragment to KSenStateSave, which means that next call
  | 
| 
williamr@2
 | 
   689  | 
        * to OnStartElementL is treated as data, and not ignored
  | 
| 
williamr@2
 | 
   690  | 
        * (in DOM fragment implementation, it would be "extended"
  | 
| 
williamr@2
 | 
   691  | 
        * into a DOM object).
  | 
| 
williamr@2
 | 
   692  | 
        */        
  | 
| 
williamr@2
 | 
   693  | 
        IMPORT_C void StartSavingContent();
  | 
| 
williamr@2
 | 
   694  | 
  | 
| 
williamr@2
 | 
   695  | 
        
  | 
| 
williamr@2
 | 
   696  | 
    private: // New functions
  | 
| 
williamr@2
 | 
   697  | 
    
  | 
| 
williamr@2
 | 
   698  | 
        /**
  | 
| 
williamr@2
 | 
   699  | 
         * Sets the XML parser to be used for parsing for the fragment.
  | 
| 
williamr@2
 | 
   700  | 
         * @since Series60 4.0
  | 
| 
williamr@2
 | 
   701  | 
         * @param aReader:      the reader to be used. 
  | 
| 
williamr@2
 | 
   702  | 
         *                      Ownership is NOT transferred.
  | 
| 
williamr@2
 | 
   703  | 
         */ 
  | 
| 
williamr@2
 | 
   704  | 
        IMPORT_C virtual void SetParser(CSenParser& aParser);
  | 
| 
williamr@2
 | 
   705  | 
  | 
| 
williamr@2
 | 
   706  | 
    protected: // Data
  | 
| 
williamr@2
 | 
   707  | 
  | 
| 
williamr@2
 | 
   708  | 
        // State variable indicating what this fragment
  | 
| 
williamr@2
 | 
   709  | 
        // is currently parsing. Even states (like 0)
  | 
| 
williamr@2
 | 
   710  | 
        // mean that this fragment is ignoring the
  | 
| 
williamr@2
 | 
   711  | 
        // data, and odd states indicate, that fragment
  | 
| 
williamr@2
 | 
   712  | 
        // is storing the data into itself.
  | 
| 
williamr@2
 | 
   713  | 
        TInt                                iState;
  | 
| 
williamr@2
 | 
   714  | 
  | 
| 
williamr@2
 | 
   715  | 
        // Owned element containing this XML fragment data.
  | 
| 
williamr@2
 | 
   716  | 
        TXmlEngElement                      iElement;
  | 
| 
williamr@2
 | 
   717  | 
        
  | 
| 
williamr@2
 | 
   718  | 
        // Owned document representing this XML fragment
  | 
| 
williamr@2
 | 
   719  | 
        RSenDocument                        iDocument;
  | 
| 
williamr@2
 | 
   720  | 
        
  | 
| 
williamr@2
 | 
   721  | 
        // Pointer to XML parser. Not owned.
  | 
| 
williamr@2
 | 
   722  | 
        CSenParser*                         ipParser;               // Not owned
  | 
| 
williamr@2
 | 
   723  | 
  | 
| 
williamr@2
 | 
   724  | 
        // Possible owner fragment, if such exists. Not owned.
  | 
| 
williamr@2
 | 
   725  | 
        CSenFragmentBase*                   ipOwner;                // Not owned
  | 
| 
williamr@2
 | 
   726  | 
        CSenFragmentBase*                   ipDelegate;             // Owned
  | 
| 
williamr@2
 | 
   727  | 
        
  | 
| 
williamr@2
 | 
   728  | 
        RPointerArray<CSenNamespaceData>*   ipNamespaceArray;       // Owned
  | 
| 
williamr@2
 | 
   729  | 
        
  | 
| 
williamr@2
 | 
   730  | 
        CBufFlat*                           ipContentBuf;           // Owned
  | 
| 
williamr@2
 | 
   731  | 
        RBufWriteStream*                    ipContentWriteStream;   // Owned
  | 
| 
williamr@2
 | 
   732  | 
    };
  | 
| 
williamr@2
 | 
   733  | 
    
  | 
| 
williamr@2
 | 
   734  | 
class CSenNamespaceData : public CBase
  | 
| 
williamr@2
 | 
   735  | 
    {
 | 
| 
williamr@2
 | 
   736  | 
    public:
  | 
| 
williamr@2
 | 
   737  | 
        virtual ~CSenNamespaceData();
  | 
| 
williamr@2
 | 
   738  | 
    
  | 
| 
williamr@2
 | 
   739  | 
    public:
  | 
| 
williamr@2
 | 
   740  | 
        HBufC8* ipLocalName;
  | 
| 
williamr@2
 | 
   741  | 
        HBufC8* ipNamespaceUri;
  | 
| 
williamr@2
 | 
   742  | 
        HBufC8* ipPrefix;
  | 
| 
williamr@2
 | 
   743  | 
    };
  | 
| 
williamr@2
 | 
   744  | 
  | 
| 
williamr@2
 | 
   745  | 
#endif //SEN_FRAGMENT_BASE_H
  | 
| 
williamr@2
 | 
   746  | 
  | 
| 
williamr@2
 | 
   747  | 
// End of File
  | 
| 
williamr@2
 | 
   748  | 
  | 
| 
williamr@2
 | 
   749  | 
  | 
| 
williamr@2
 | 
   750  | 
  |