SenXmlReader.h

Go to the documentation of this file.
00001 /*
00002 * ==============================================================================
00003 *  Name        : SenXmlReader.h
00004 *  Part of     : Web Services Xml
00005 *  Interface   : 
00006 *  Description : Class extends Symbian XML framework parser functionality
00007 *  Version     : 
00008 *
00009 *  Copyright © 2002-2005 Nokia. All rights reserved.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia. All rights are reserved. Copying, including 
00013 *  reproducing, storing, adapting or translating, any 
00014 *  or all of this material requires the prior written consent of 
00015 *  Nokia. This material also contains confidential 
00016 *  information which may not be disclosed to others without the 
00017 *  prior written consent of Nokia.
00018 * ==============================================================================
00019 */
00020 
00021 #ifndef SEN_XMLREADER_H
00022 #define SEN_XMLREADER_H
00023 
00024 //  INCLUDES
00025 #include <Xml/Parser.h>
00026 #include <Xml/ParserFeature.h> // for TParserFeature enumeration
00027 #include <Xml/ContentHandler.h>
00028 #include <badesca.h>
00029 
00030 using namespace Xml;
00031 
00032 // CONSTANTS
00033 const TInt KSenDefaultParserFeature = (TInt)EReportNamespaceMapping;
00034 
00035 
00036    
00037 // FORWARD DECLARATIONS
00038 class MSenContentHandlerClient;
00039 class RFs;
00040 
00041 // CLASS DECLARATION
00042 
00051 class CSenXmlReader : public CBase, public MContentHandler 
00052     {
00053     public:  // Constructors and destructor
00054     
00062         IMPORT_C static CSenXmlReader* NewL();
00063 
00072         IMPORT_C static CSenXmlReader* NewLC();
00073 
00084         IMPORT_C static CSenXmlReader* NewL(TInt aParserFeature);
00085 
00101         IMPORT_C static CSenXmlReader* NewLC(TInt aParserFeature);
00102 
00114         IMPORT_C static CSenXmlReader* NewL(const TDesC8& aParserMimeType);
00115 
00127         IMPORT_C static CSenXmlReader* NewLC(const TDesC8& aParserMimeType);
00128 
00138         IMPORT_C static CSenXmlReader* NewL(const TDesC8& aParserMimeType,
00139                                             TInt aParserFeature);
00140 
00155         IMPORT_C static CSenXmlReader* NewLC(const TDesC8& aParserMimeType,
00156                                              TInt aParserFeature);
00157 
00161         IMPORT_C virtual ~CSenXmlReader();
00162 
00163         // New functions
00164 
00171         IMPORT_C virtual void SetContentHandler(
00172                     MSenContentHandlerClient& aContentHandler);
00173 
00179         IMPORT_C virtual TInt EnabledParserFeature();
00180 
00184         IMPORT_C virtual TInt ParserFeature();
00185 
00195         TInt SetParserFeature(TInt aParserFeature);     
00196 
00234         IMPORT_C void ParseL(const TDesC8& aBuff);
00235 
00242         IMPORT_C void ParseL(RFs &aRFs, const TDesC& aFileToParse);
00243         
00244         // Functions from base classes 
00245         
00246         // Callback functions implementing Symbian MContentHandler interface
00247 
00256         virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, 
00257                                       TInt aErrorCode);
00258 
00267         virtual void OnEndDocumentL(TInt aErrorCode);
00268 
00277         virtual void OnStartElementL(const RTagInfo& aElement, 
00278                                      const RAttributeArray& aAttributes, 
00279                                      TInt aErrorCode);
00280 
00289         virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
00290 
00297         virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
00298 
00307         virtual void OnStartPrefixMappingL(const RString& aPrefix, 
00308                                            const RString& aUri, 
00309                                            TInt aErrorCode);
00310 
00319         virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
00320 
00329         virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
00330 
00339         virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
00340 
00349         virtual void OnProcessingInstructionL(const TDesC8& aTarget, 
00350                                               const TDesC8& aData, 
00351                                               TInt aErrorCode);
00352 
00369         virtual void OnError(TInt aErrorCode);
00370 
00379         virtual TAny* GetExtendedInterface(const TInt32 aUid);
00380         
00381     protected:
00382         
00386         IMPORT_C CSenXmlReader(TInt aParserFeature);
00387         
00393         void ConstructL(const TDesC8& aParserMimeType);
00394         
00395         // New functions
00396         
00401         void RecreateParserL();
00402         
00403     private:
00404         static void CleanupParser(TAny* apReader);
00405 
00406         void CleanUp();
00407 
00408     private:    // Data
00409             // Owned instance of Symbian XML framework (default) XML parser
00410         CParser* iParser;
00411             // Not owned pointer to XML content handler.
00412         MSenContentHandlerClient* iContentHandler;
00413         // Owned pointer to XML namespace prefix strings
00414         CDesC8Array* ipNsPrefixes;
00415         // Owned pointer to XML namespace URI strings
00416         CDesC8Array* ipNsUris;
00417         // Owned string pool for XML attribute handling.
00418         RStringPool iStringPool;
00419             // Integer indicating currently enabled features
00420         TInt iEnabledFeature;
00421     };
00422 
00423 #endif  // SEN_XMLREADER_H
00424     
00425 // End of File
00426 

Copyright © Nokia Corporation 2001-2007
Back to top