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 __SENXMLREADER_H 00022 #define __SENXMLREADER_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 // FORWARD DECLARATIONS 00036 class MSenContentHandlerClient; 00037 class RFs; 00038 00039 // CLASS DECLARATION 00040 00049 class CSenXmlReader : public CBase, public MContentHandler 00050 { 00051 public: // Constructors and destructor 00052 00058 IMPORT_C static CSenXmlReader* NewL(); 00059 00066 IMPORT_C static CSenXmlReader* NewLC(); 00067 00077 IMPORT_C static CSenXmlReader* NewL(TInt aParserFeature); 00078 00088 IMPORT_C static CSenXmlReader* NewLC(TInt aParserFeature); 00089 00093 IMPORT_C virtual ~CSenXmlReader(); 00094 00095 // New functions 00096 00103 IMPORT_C virtual void SetContentHandler( 00104 MSenContentHandlerClient& aContentHandler); 00105 00111 IMPORT_C virtual TInt EnabledParserFeature(); 00112 00116 IMPORT_C virtual TInt ParserFeature(); 00117 00126 TInt SetParserFeature(TInt aParserFeature); 00127 00133 IMPORT_C void ParseL(const TDesC8& aBuff); 00134 00141 IMPORT_C void ParseL(RFs &aRFs, const TDesC& aFileToParse); 00142 00143 // Functions from base classes 00144 00145 // Callback functions implementing Symbian MContentHandler interface 00146 00155 virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, 00156 TInt aErrorCode); 00157 00166 virtual void OnEndDocumentL(TInt aErrorCode); 00167 00176 virtual void OnStartElementL(const RTagInfo& aElement, 00177 const RAttributeArray& aAttributes, 00178 TInt aErrorCode); 00179 00188 virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode); 00189 00196 virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode); 00197 00206 virtual void OnStartPrefixMappingL(const RString& aPrefix, 00207 const RString& aUri, 00208 TInt aErrorCode); 00209 00218 virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); 00219 00228 virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); 00229 00238 virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode); 00239 00248 virtual void OnProcessingInstructionL(const TDesC8& aTarget, 00249 const TDesC8& aData, 00250 TInt aErrorCode); 00251 00260 virtual void OnError(TInt aErrorCode); 00261 00274 virtual TAny* GetExtendedInterface(const TInt32 aUid); 00275 00276 protected: 00277 00281 IMPORT_C CSenXmlReader(TInt aParserFeature); 00282 00286 void ConstructL(); 00287 00288 // New functions 00289 00294 void RecreateParserL(); 00295 00296 private: // Data 00297 // Owned instance of Symbian XML framework (default) XML parser 00298 CParser* iParser; 00299 // Not owned pointer to XML content handler. 00300 MSenContentHandlerClient* iContentHandler; 00301 // Owned pointer to XML namespace prefix strings 00302 CDesC8Array* ipNsPrefixes; 00303 // Owned pointer to XML namespace URI strings 00304 CDesC8Array* ipNsUris; 00305 // Owned string pool for XML attribute handling. 00306 RStringPool iStringPool; 00307 // Integer indicating currently enabled features 00308 TInt iEnabledFeature; 00309 }; 00310 00311 // __SENXMLREADER_H 00312 #endif 00313 00314 // End of File 00315