xdmprotocols/XdmXmlParser/inc/XdmXmlParser.h
branchRCL_3
changeset 35 fbd2e7cec7ef
parent 0 c8caa15ef882
equal deleted inserted replaced
34:2669f8761a99 35:fbd2e7cec7ef
       
     1 /*
       
     2 * Copyright (c) 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:   CXdmXmlParser
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __XDMXMLPARSER__
       
    22 #define __XDMXMLPARSER__
       
    23 
       
    24 #include <parser.h>
       
    25 
       
    26 //CONSTANTS
       
    27 _LIT( KParserLogFile,                   "XcapXml" );
       
    28 _LIT8( KDefaultMimeType,                "text/xml" );
       
    29 
       
    30 using namespace Xml;
       
    31 
       
    32 //FORWARD DECLARATION
       
    33 class CXdmDocument;
       
    34 class CXdmLogWriter;
       
    35 class CXmlFormatter;
       
    36 class CXdmDocumentNode;
       
    37 class MXdmNodeInterface;
       
    38 class CXdmXmlContentHandler;
       
    39 class MXdmNamespaceContainer;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 class CXdmXmlParser: public CBase
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45         
       
    46         /**
       
    47         * Symbian OS Constructor
       
    48         * @return CXdmXmlParser New parser intance  
       
    49         */     
       
    50         IMPORT_C static CXdmXmlParser* NewL();
       
    51         
       
    52         /**
       
    53         * Parse an XML document
       
    54         * @param CXdmDocument Document instance
       
    55         * @param TDesC8& The raw XML data
       
    56         * @return void
       
    57         */    
       
    58         IMPORT_C void ParseDocumentL( CXdmDocument* aDocument,
       
    59                                        const TDesC8& aXmlDocument );
       
    60         
       
    61         /**
       
    62         * Parse an XML document
       
    63         * @param CXdmDocument Document instance
       
    64         * @param TDesC8& The raw XML data
       
    65         * @param Pointer to the document/fragment root
       
    66         * @return void
       
    67         */     
       
    68         IMPORT_C void ParseDocumentL( CXdmDocument* aDocument,
       
    69                                       const TDesC8& aXmlDocument,
       
    70                                       CXdmDocumentNode* aDocumentSubset );
       
    71         
       
    72         /**
       
    73         * Parse an XML document
       
    74         * @param TDesC8& The raw XML data
       
    75         * @param Pointer to the document/fragment root
       
    76         * @return void
       
    77         */       
       
    78         IMPORT_C void ParseDocumentL( const TDesC8& aXmlDocument,
       
    79                                       CXdmDocumentNode* aDocumentRoot );
       
    80 
       
    81         /**
       
    82         * Format a document model into textual form
       
    83         * @param TBool Indicates whether the document is whole
       
    84         * @param CXdmDocument The document instance
       
    85         * @param CXdmDocumentNode Pointer to the document/fragment root
       
    86         * @return HBufC8* The document in textual form
       
    87         */       
       
    88         IMPORT_C HBufC8* FormatToXmlLC( TBool aIsWholeDocument,
       
    89                                         const CXdmDocument* aDocument,
       
    90                                         const CXdmDocumentNode* aRootNode );
       
    91                                                
       
    92         /**
       
    93         * Format a document model into textual form and append the fragment
       
    94         * in the first parameter to the correct place inside the document.
       
    95         * @param TDesC8& The fragment to append
       
    96         * @param CXdmDocument The document instance
       
    97         * @param CXdmDocumentNode Pointer to the fragment
       
    98         * @return HBufC8* The document in textual form
       
    99         */        
       
   100         IMPORT_C HBufC8* FormatToXmlLC( const TDesC8& aXmlFragment,
       
   101                                         const CXdmDocument* aDocument,
       
   102                                         const CXdmDocumentNode* aTargetNode );
       
   103                                                
       
   104         /**
       
   105         * Destructor.
       
   106         */      
       
   107         IMPORT_C virtual ~CXdmXmlParser();
       
   108 
       
   109     public: 
       
   110     
       
   111     #ifdef _DEBUG
       
   112         
       
   113         /**
       
   114         * Write to log file
       
   115         * @param TRefByValue<const TDesC8> The log line
       
   116         * @return void
       
   117         */  
       
   118         void WriteToLog( TRefByValue<const TDesC8> aFmt,... ) const;
       
   119     
       
   120     #endif
       
   121         
       
   122     public:   
       
   123     
       
   124         /**
       
   125         * Stop the parser
       
   126         * @return void
       
   127         */  
       
   128         void FinishParsingL();
       
   129         
       
   130     private:
       
   131         
       
   132         /**
       
   133         * C++ constructor is private
       
   134         * @return CXdmXmlParser
       
   135         */    
       
   136         CXdmXmlParser();
       
   137 
       
   138         /**
       
   139         * Second-phase constructor
       
   140         * @return void
       
   141         */    
       
   142         void ConstructL();
       
   143                           
       
   144     #ifdef _DEBUG
       
   145     
       
   146         /**
       
   147         * Return the current system time
       
   148         * @return TInt Current system time in integer format
       
   149         */  
       
   150         static TInt TimeL();
       
   151         
       
   152         /**
       
   153         * Write the formatted document to the log folder
       
   154         * @param HBufC8* Pointer to the data segment
       
   155         * @return void
       
   156         */  
       
   157         void DumpDocumentL( HBufC8* aDocData );
       
   158     
       
   159     #endif
       
   160             
       
   161     private: //Data
       
   162         
       
   163         TInt                                iDumpIndex;
       
   164         TPtr8                               iXmlDocument;
       
   165         CParser*                            iXmlParser;
       
   166         CXdmLogWriter*                      iLogWriter;
       
   167         CXmlFormatter*                      iXmlFormatter;
       
   168         TRequestStatus*                     iClientStatus;
       
   169         CXdmXmlContentHandler*              iContentHandler;
       
   170     };
       
   171 
       
   172 #endif  //__XDMXMLPARSER__
       
   173 
       
   174 
       
   175 // End of File