websrv_pub/xml_extensions_api/inc/SenDomFragment.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:        Class implements DOM fragment functionality
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef SEN_DOM_FRAGMENT_H
       
    26 #define SEN_DOM_FRAGMENT_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <SenBaseFragment.h>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class RFileLogger;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * Class implements DOM fragment functionality
       
    38 * The implementation further extends CSenBaseFragment
       
    39 * functionality. In DOM fragment, all child elements
       
    40 * are parsed into separate element objects. This makes
       
    41 * it possible to reference any child which offer methods
       
    42 * declared in XML element interface. Any such element
       
    43 * can also be easily extracted (detached) from this
       
    44 * root DOM fragmet.
       
    45 * @lib SenXML.dll
       
    46 * @since Series60 3.0
       
    47 */
       
    48 class CSenDomFragment : public CSenBaseFragment
       
    49     {
       
    50     public:  // Constructors and destructor
       
    51         
       
    52         /**
       
    53         * Basic contructor. Should be used only for parsing new fragments etc. 
       
    54         * Constructing DomFragments for other use should be done with at least 
       
    55         * localname parameter.
       
    56         * @since Series60 3.0
       
    57         */
       
    58         IMPORT_C static CSenDomFragment* NewL();
       
    59 
       
    60         /**
       
    61         * Basic constructor.
       
    62         * @since Series60 3.0
       
    63         * @param aElement Element to copy construction data from.
       
    64         */
       
    65         IMPORT_C static CSenDomFragment* NewL(
       
    66             const CSenElement& aElement);
       
    67 
       
    68         /**
       
    69         * Basic constructor.
       
    70         * @since Series60 3.0
       
    71         * @param aLocalName is the XML localname of this fragment
       
    72         * Leave codes:  
       
    73         *       KErrSenInvalidCharacters if aLocalName contains
       
    74         *       illegal characters.     
       
    75         *       KErrSenZeroLengthDescriptor if aLocalName is zero length.
       
    76         */
       
    77         IMPORT_C static CSenDomFragment* NewL(const TDesC8& aLocalName);
       
    78 
       
    79         /**
       
    80         * Basic constructor.
       
    81         * @since Series60 3.0
       
    82         * @param aNsUri is the XML namespace user of this fragment
       
    83         * @param aLocalName is the XML localname of this fragment
       
    84         * Leave codes:  
       
    85         *       KErrSenInvalidCharacters if aLocalName contains
       
    86         *       illegal characters.     
       
    87         *       KErrSenZeroLengthDescriptor if aLocalName is zero length.
       
    88         */
       
    89         IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
       
    90                                               const TDesC8& aLocalName);
       
    91 
       
    92         /**
       
    93         * Basic constructor.
       
    94         * @since Series60 3.0
       
    95         * @param aNsUri is the XML namespace user of this fragment
       
    96         * @param aLocalName is the XML localname of this fragment
       
    97         * @param aQName is the XML qualifiedname of this fragment
       
    98         * Leave codes:  
       
    99         *       KErrSenInvalidCharacters if aLocalName or aQName contains
       
   100         *       illegal characters.     
       
   101         *       KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
       
   102         */
       
   103         IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
       
   104                                               const TDesC8& aLocalName,
       
   105                                               const TDesC8& aQName);
       
   106 
       
   107         /**
       
   108         * Basic constructor.
       
   109         * @since Series60 3.0
       
   110         * @param aNsUri is the XML namespace of this fragment
       
   111         * @param aLocalName is the XML localname of this fragment
       
   112         * @param aQName is the qualifiedname of this fragment
       
   113         * @param aAttrs are the XML attributes of this fragment
       
   114         * Leave codes:  
       
   115         *       KErrSenInvalidCharacters if aLocalName or aQName contains
       
   116         *       illegal characters.     
       
   117         *       KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
       
   118         */
       
   119         IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
       
   120                                               const TDesC8& aLocalName,
       
   121                                               const TDesC8& aQName,
       
   122                                               const RAttributeArray& aAttrs);
       
   123 
       
   124         /**
       
   125         * Basic constructor.
       
   126         * @since Series60 3.0
       
   127         * @param aNsUri is the XML namespace of this fragment
       
   128         * @param aLocalName is the XML localname of this fragment
       
   129         * @param aQName is the qualifiedname of this fragment
       
   130         * @param aAttrs are the XML attributes of this fragment
       
   131         * @param aParent is the parent XML element of this fragment
       
   132         * Leave codes:  
       
   133         *       KErrSenInvalidCharacters if aLocalName or aQName contains
       
   134         *       illegal characters.     
       
   135         *       KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
       
   136         */
       
   137         IMPORT_C static CSenDomFragment* NewL(const TDesC8& aNsUri,
       
   138                                               const TDesC8& aLocalName,
       
   139                                               const TDesC8& aQName,
       
   140                                               const RAttributeArray& aAttrs,
       
   141                                               CSenElement& aParent);
       
   142 
       
   143         /**
       
   144         * Destructor.
       
   145         */
       
   146         IMPORT_C virtual ~CSenDomFragment();
       
   147 
       
   148         // New functions
       
   149     
       
   150         /**
       
   151         * Initiates the parsing chain where new delegate will be created with
       
   152         * given parameters and parsing will be delegated to it. Should not be
       
   153         * called externally.
       
   154         * @since Series60 3.0
       
   155         * @param aNsUri     The namespace URI of the new element
       
   156         * @param aLocalName The local name of the new element
       
   157         * @param aQName     The qualified name of the new element
       
   158         * @param aAttrs     The attributes of the new element
       
   159         */
       
   160         IMPORT_C virtual void ExpandL(const TDesC8& aNsUri,
       
   161                                       const TDesC8& aLocalName,
       
   162                                       const TDesC8& aQName,
       
   163                                       const RAttributeArray& aAttrs);
       
   164                                       
       
   165         // Functions from base classes
       
   166 
       
   167         // From CSenBaseFragment
       
   168         
       
   169         /**
       
   170         * Resumes the parsing. Usually called by the delegate fragment which was
       
   171         *                       parsing itself after DelegateParsingL().
       
   172         * @since Series60 3.0
       
   173         * @param aNsUri     The namespace URI of the current element
       
   174         * @param aLocalName The local name of the current element
       
   175         * @param aQName     The qualified name of the current element
       
   176         */
       
   177         IMPORT_C void ResumeParsingFromL(const TDesC8& aNsUri,
       
   178                                          const TDesC8& aLocalName,
       
   179                                          const TDesC8& aQName);
       
   180 
       
   181         /**
       
   182         * Sets the reader for this fragment and sets this to be the 
       
   183         * content handler of the following SAX events.
       
   184         * @since Series60 3.0
       
   185         * @param aReader:   Reader to be used.
       
   186         */
       
   187         IMPORT_C virtual void ParseWithL(CSenXmlReader& aReader);
       
   188 
       
   189         /**
       
   190         * Sets the attributes for the fragment.
       
   191         * @since Series60 3.0
       
   192         * @param aAttrs the array of attributes.
       
   193         */
       
   194         IMPORT_C virtual void SetAttributesL(const RAttributeArray& aAttrs);
       
   195 
       
   196     protected:  
       
   197         
       
   198         /**
       
   199         * C++ default constructor.
       
   200         */
       
   201         IMPORT_C CSenDomFragment();
       
   202 
       
   203         /**
       
   204         * "ConstructL" method for calling the base classes ones.
       
   205         * @since Series60 3.0
       
   206         * @param aElement is the XML element of this fragment.
       
   207         */
       
   208         IMPORT_C void BaseConstructL(const CSenElement& aElement);
       
   209 
       
   210         /**
       
   211         * "ConstructL" method for calling the base classes ones.
       
   212         * @since Series60 3.0
       
   213         * @param aLocalName The local name of the element
       
   214         */
       
   215         IMPORT_C void BaseConstructL(const TDesC8& aLocalName);
       
   216 
       
   217         /**
       
   218         * "ConstructL" method for calling the base classes ones.
       
   219         * @since Series60 3.0
       
   220         * @param aNsUri     The namespace URI of the element
       
   221         * @param aLocalName The local name of the element
       
   222         */
       
   223         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
       
   224                                      const TDesC8& aLocalName);
       
   225 
       
   226         /**
       
   227         * "ConstructL" method for calling the base classes ones.
       
   228         * @since Series60 3.0
       
   229         * @param aNsUri     The namespace URI of the element
       
   230         * @param aLocalName The local name of the element
       
   231         * @param aQName     The qualified name of the element
       
   232         */
       
   233         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
       
   234                                      const TDesC8& aLocalName,
       
   235                                      const TDesC8& aQName);
       
   236 
       
   237         /**
       
   238         * "ConstructL" method for calling the base classes ones.
       
   239         * @since Series60 3.0
       
   240         * @param aNsUri     The namespace URI of the element
       
   241         * @param aLocalName The local name of the element
       
   242         * @param aQName     The qualified name of the element
       
   243         * @param aAttrs     The attributes of the element
       
   244         */
       
   245         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
       
   246                                      const TDesC8& aLocalName,
       
   247                                      const TDesC8& aQName,
       
   248                                      const RAttributeArray& aAttrs);
       
   249 
       
   250         /**
       
   251         * "ConstructL" method for calling the base classes ones.
       
   252         * @since Series60 3.0
       
   253         * @param aNsUri     The namespace URI of the element
       
   254         * @param aLocalName The local name of the element
       
   255         * @param aQName     The qualified name of the element
       
   256         * @param aAttrs     The attributes of the element
       
   257         * @param aParent    The parent of the element
       
   258         */
       
   259         IMPORT_C void BaseConstructL(const TDesC8& aNsUri,
       
   260                                      const TDesC8& aLocalName,
       
   261                                      const TDesC8& aQName,
       
   262                                      const RAttributeArray& aAttrs,
       
   263                                      CSenElement& aParent);
       
   264 
       
   265         /**
       
   266         * "ConstructL" method for calling the base classes ones.
       
   267         * @since Series60 3.0
       
   268         * @param aReader is the XML reader for this fragment.
       
   269         */
       
   270         IMPORT_C void BaseConstructL(CSenXmlReader& aReader);
       
   271         
       
   272         // Functions from base classes
       
   273         
       
   274         /**
       
   275          *  Callback functions which implement the XML content handler interface.
       
   276          *  Inheriting classes can override these.
       
   277          */
       
   278          
       
   279         // From CSenBaseFragment 
       
   280         
       
   281         /**
       
   282         * @since Series60 3.0
       
   283         * @param aNsUri     The namespace URI of the element
       
   284         * @param aLocalName The local name of the element
       
   285         * @param aQName     The qualified name of the element
       
   286         * @param aAttrs     The attributes of the element
       
   287         */
       
   288         IMPORT_C virtual void StartElementL(const TDesC8& aNsUri,
       
   289                                             const TDesC8& aLocalName,
       
   290                                             const TDesC8& aQName,
       
   291                                             const RAttributeArray& aAttrs);
       
   292         
       
   293         /**
       
   294         * Callback functions which implement the XML content handler interface.
       
   295         * This one is called when content is starting.
       
   296         * @since Series60 3.0
       
   297         * @param aChars     The content characters.
       
   298         * @param aStart     The starting index
       
   299         * @param aLength    The length of the characters.
       
   300         */
       
   301         IMPORT_C virtual void CharactersL(const TDesC8& aChars,TInt aStart,TInt aLength);
       
   302 
       
   303         /**
       
   304         * Overriding content writing from CSenBaseFragment to do nothing in
       
   305         * DOM fragment (because the tree is expanded).
       
   306         * @since Series60 3.0
       
   307         * @param aNsUri     not used
       
   308         * @param aLocalName not used
       
   309         * @param aQName     not used
       
   310         * @param aAttrs     not used
       
   311         */
       
   312         IMPORT_C void WriteStartElementL(const TDesC8& aNsUri,
       
   313                                          const TDesC8& aLocalName,
       
   314                                          const TDesC8& aQName,
       
   315                                          const RAttributeArray& aAttrs);
       
   316 
       
   317         /**
       
   318         * Overriding content writing from CSenBaseFragment to do nothing in
       
   319         * DOM fragment (because the tree is expanded).
       
   320         * @since Series60 3.0
       
   321         * @param aNsUri     not used
       
   322         * @param aLocalName not used
       
   323         * @param aQName     not used
       
   324         */
       
   325         IMPORT_C void WriteEndElementL(const TDesC8& aNsUri,
       
   326                                        const TDesC8& aLocalName,
       
   327                                        const TDesC8& aQName);
       
   328 
       
   329     protected: // Data
       
   330         CSenDomFragment* ipDomDelegate;
       
   331     };
       
   332 
       
   333 #endif //SEN_DOM_FRAGMENT_H
       
   334 
       
   335 // End of File
       
   336 
       
   337 
       
   338