|         |      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:        This is the real, internal implementation of CSenParser | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18  | 
|         |     19  | 
|         |     20  | 
|         |     21  | 
|         |     22  | 
|         |     23  | 
|         |     24  | 
|         |     25 #ifndef SEN_PARSERIMPL_H | 
|         |     26 #define SEN_PARSERIMPL_H | 
|         |     27  | 
|         |     28 #include <SenParser.h> | 
|         |     29  | 
|         |     30 class CSenParserImpl : public CSenParser | 
|         |     31     { | 
|         |     32     public: // Constructors and destructor | 
|         |     33  | 
|         |     34         static CSenParserImpl* NewL(); | 
|         |     35         static CSenParserImpl* NewLC(); | 
|         |     36  | 
|         |     37         static CSenParserImpl* NewL(CParser* aParser); | 
|         |     38         static CSenParserImpl* NewLC(CParser* aParser); | 
|         |     39  | 
|         |     40         static CSenParserImpl* NewL(const TDesC8& aParserMimeType); | 
|         |     41         static CSenParserImpl* NewLC(const TDesC8& aParserMimeType); | 
|         |     42  | 
|         |     43         virtual ~CSenParserImpl(); | 
|         |     44          | 
|         |     45         virtual void SetContentHandler(CSenFragmentBase& aContentHandler); | 
|         |     46  | 
|         |     47         virtual void ParseBeginL(); | 
|         |     48         virtual void ParseBeginL(const TDesC8& aDocumentMimeType); | 
|         |     49  | 
|         |     50  | 
|         |     51         virtual void ParseL(const TDesC8& aFragment, | 
|         |     52                                 CSenFragmentBase& aContentHandler); | 
|         |     53         virtual void ParseL(RFs& aFs, const TDesC& aFilename, | 
|         |     54                                  CSenFragmentBase& aContentHandler); | 
|         |     55         virtual void ParseL(RFile& aFile, CSenFragmentBase& aContentHandler); | 
|         |     56                                  | 
|         |     57         virtual void ParseEndL(); | 
|         |     58  | 
|         |     59         virtual void SetProcessorChainL(const RContentProcessorUids& aPlugins); | 
|         |     60  | 
|         |     61         virtual TInt EnableFeature(TInt aParserFeature); | 
|         |     62         virtual TInt DisableFeature(TInt aParserFeature); | 
|         |     63         virtual TBool IsFeatureEnabled(TInt aParserFeature) const; | 
|         |     64  | 
|         |     65         virtual void AddPreloadedDictionaryL(const TDesC8& aPublicId); | 
|         |     66  | 
|         |     67         virtual RStringPool& StringPool(); | 
|         |     68         virtual RStringDictionaryCollection& StringDictionaryCollection(); | 
|         |     69  | 
|         |     70     private: | 
|         |     71         CSenParserImpl(CParser* apParser); | 
|         |     72         void ConstructL(); | 
|         |     73         void ConstructL(const TDesC8& aParserMimeType); | 
|         |     74  | 
|         |     75     private: // Data | 
|         |     76         CSenContentHandler*     ipContentHandler; | 
|         |     77         CParser*                ipParser; | 
|         |     78     }; | 
|         |     79  | 
|         |     80 NONSHARABLE_CLASS(CSenContentHandler) : public CBase, public MContentHandler | 
|         |     81     { | 
|         |     82     public: // Constructors and destructor | 
|         |     83  | 
|         |     84         static CSenContentHandler* NewL(); | 
|         |     85         static CSenContentHandler* NewLC(); | 
|         |     86  | 
|         |     87         static CSenContentHandler* NewL(MContentHandler& aContentHandler); | 
|         |     88         static CSenContentHandler* NewLC(MContentHandler& aContentHandler); | 
|         |     89          | 
|         |     90         virtual ~CSenContentHandler(); | 
|         |     91  | 
|         |     92         void SetContentHandler(MContentHandler& aContentHandler); | 
|         |     93  | 
|         |     94         MContentHandler& ContentHandler(); | 
|         |     95  | 
|         |     96     public: // From MContentHandler | 
|         |     97  | 
|         |     98         virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode); | 
|         |     99  | 
|         |    100         virtual void OnEndDocumentL(TInt aErrorCode); | 
|         |    101  | 
|         |    102  | 
|         |    103         virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, | 
|         |    104                                  TInt aErrorCode); | 
|         |    105  | 
|         |    106         virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); | 
|         |    107  | 
|         |    108         virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode); | 
|         |    109  | 
|         |    110         virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, | 
|         |    111                                        TInt aErrorCode); | 
|         |    112  | 
|         |    113         virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); | 
|         |    114  | 
|         |    115         virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); | 
|         |    116  | 
|         |    117         virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode); | 
|         |    118  | 
|         |    119         virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, | 
|         |    120                                           TInt aErrorCode); | 
|         |    121  | 
|         |    122         /* | 
|         |    123         * Symbian XML Framework errocodes: | 
|         |    124         * [from XmlParserErrors.h] | 
|         |    125         * EXmlParserError = -1000, | 
|         |    126         * EXmlSyntax = 2+EXmlParserError,       // -998 | 
|         |    127         * EXmlNoElements,                       // -997 | 
|         |    128         * EXmlInvalidToken,                     // -996 | 
|         |    129         * EXmlUnclosedToken,                    // -995 | 
|         |    130         * EXmlPartialChar,                      // -994 | 
|         |    131         * EXmlTagMismatch,                      // -993 | 
|         |    132         * EXmlDuplicateAttribute,               // -992 | 
|         |    133         * EXmlJunkAfterDocElement,              // -991 | 
|         |    134         * EXmlPeRef,                            // -990 | 
|         |    135         * EXmlUndefinedEntity,                  // -989 | 
|         |    136         * EXmlRecursiveEntity,                  // -988 | 
|         |    137         * EXmlAsyncEntity,                      // -987 | 
|         |    138         * EXmlBadCharRef,                       // -986 | 
|         |    139         * EXmlBinaryEntityRef,                  // -985 | 
|         |    140         * EXmlAttributeExternalEntityRef,       // -984 | 
|         |    141         * EXmlMisplacedPi,                      // -983 | 
|         |    142         * EXmlUnknownEncoding,                  // -982 | 
|         |    143         * EXmlIncorrectEncoding,                // -981 | 
|         |    144         * EXmlUnclosedCdata,                    // -980 | 
|         |    145         * EXmlExternalEntityHandling,           // -979 | 
|         |    146         * EXmlNotStandalone,                    // -978 | 
|         |    147         * EXmlUnexpectedState,                  // -977 | 
|         |    148         * EXmlEntityDeclInPe,                   // -976 | 
|         |    149         * EXmlDtdRequired,                      // -975 | 
|         |    150         * EXmlFeatureLockedWhileParsing         // -974 | 
|         |    151         */ | 
|         |    152         virtual void OnError(TInt aErrorCode); | 
|         |    153  | 
|         |    154         virtual TAny* GetExtendedInterface(const TInt32 aUid); | 
|         |    155  | 
|         |    156     private: | 
|         |    157         CSenContentHandler(MContentHandler* apContentHandler); | 
|         |    158  | 
|         |    159     private: // Data | 
|         |    160         MContentHandler* ipContentHandler; | 
|         |    161     }; | 
|         |    162  | 
|         |    163 #endif //SEN_PARSERIMPL_H | 
|         |    164  | 
|         |    165 // End of File |