epoc32/include/xmlengdomparser.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/xmlengdomparser.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/xmlengdomparser.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,184 @@
     1.4 -xmlengdomparser.h
     1.5 +/*
     1.6 +* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). 
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:       DOM parser functions
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +
    1.26 +
    1.27 +
    1.28 +#ifndef XMLENGINE_DOMPARSER_H_INCLUDED
    1.29 +#define XMLENGINE_DOMPARSER_H_INCLUDED
    1.30 +
    1.31 +#include <f32file.h>
    1.32 +
    1.33 +class RXmlEngDOMImplementation;
    1.34 +class RXmlEngDocument;
    1.35 +
    1.36 +/** 
    1.37 + * DOM parser class implements methods for parsing XML data.
    1.38 + *
    1.39 + * Parse XML data in one chunk. Data can be parsed from file 
    1.40 + * or memory buffer.
    1.41 + *
    1.42 + * Sample code for parsing from buffer:
    1.43 + * @code
    1.44 + *      RXmlEngDOMImplementation domImpl;
    1.45 + *      domImpl.OpenL();              ///< opening DOM implementation object 
    1.46 + *      RXmlEngDOMParser parser;
    1.47 + *      parser.Open( domImpl );   ///< opening parser object
    1.48 + *      RXmlEngDocument iDoc;
    1.49 + *      iDoc =parser.ParseL( *aInput );   ///< parsing aInput - buffer  
    1.50 + *      iDoc.Close();               ///< closing all opened objects
    1.51 + *      parser.Close();
    1.52 + *      domImpl.Close();
    1.53 + * @endcode 
    1.54 + * 
    1.55 + * Sample code for parsing from file:
    1.56 + * @code
    1.57 + *      RXmlEngDOMImplementation domImpl;
    1.58 + *      domImpl.OpenL();              ///< opening DOM implementation object 
    1.59 + *      RXmlEngDOMParser parser;
    1.60 + *      parser.Open( domImpl );   ///< opening parser object
    1.61 + *      RXmlEngDocument iDoc;
    1.62 + *      iDoc =parser.ParseFileL( aFileName );   ///< parsing from file  
    1.63 + *      iDoc.Close();               ///< closing all openend objects
    1.64 + *      parser.Close();
    1.65 + *      domImpl.Close();
    1.66 + * @endcode 
    1.67 + * 
    1.68 + * @lib XmlEngineDOM.lib
    1.69 + * @since S60 v3.1
    1.70 + */
    1.71 +class RXmlEngDOMParser
    1.72 +{
    1.73 +public:
    1.74 +    /**
    1.75 +     * Default constructor
    1.76 +     */
    1.77 +    IMPORT_C RXmlEngDOMParser();
    1.78 +	
    1.79 +    /** 
    1.80 +     * Opens the parser.
    1.81 +     *
    1.82 +	 * @since S60 v3.2
    1.83 +	 * @param aDOMImpl DOM implementation object
    1.84 +     * @return KErrNone if succeed.
    1.85 +     */
    1.86 +    IMPORT_C TInt Open(RXmlEngDOMImplementation& aDOMImpl);
    1.87 +    
    1.88 +    /** 
    1.89 +     * Closes the parser.
    1.90 +     *
    1.91 +	 * @since S60 v3.2
    1.92 +	 */
    1.93 +    IMPORT_C void Close();
    1.94 +
    1.95 +    /** 
    1.96 +     * Parses chunk of XML data from memory buffer and builds DOM RXmlEngDocument.
    1.97 +     *
    1.98 +     * @since S60 v3.2
    1.99 +     * @param aBuffer XML data buffer
   1.100 +     * 
   1.101 +     * @leave KXmlEngErrParsing or one of general codes (e.g. KErrNoMemory)
   1.102 +     */
   1.103 +    IMPORT_C void ParseChunkL(const TDesC8& aBuffer);
   1.104 +    /** 
   1.105 +     * Creates document from parsed chunks of data.
   1.106 +     * Should be called after parsing of allchunks.
   1.107 +     * Ownership over returned RXmlEngDocument object is transferred to the caller of the method.
   1.108 +     *
   1.109 +     * @since S60 v3.2
   1.110 +     * @return RXmlEngDocument created document.
   1.111 +     * 
   1.112 +     * @leave KXmlEngErrParsing or one of general codes (e.g. KErrNoMemory)
   1.113 +     */
   1.114 +    IMPORT_C RXmlEngDocument FinishL();
   1.115 +    
   1.116 +    /** 
   1.117 +     * Parses XML file and builds DOM RXmlEngDocument
   1.118 +     *
   1.119 +     * @since S60 v3.2
   1.120 +	 * @param aRFs File server session
   1.121 +     * @param aFileName File name
   1.122 +     * @param aChunkSize Size of chunk (if 0 chunks won't be used)
   1.123 +     * @return Document handle
   1.124 +     * 
   1.125 +     * @leave KXmlEngErrParsing or one of general codes (e.g. KErrNoMemory)
   1.126 +	 */
   1.127 +    IMPORT_C RXmlEngDocument ParseFileL(RFs &aRFs, const TDesC& aFileName, TUint aChunkSize = 0);
   1.128 +
   1.129 +    /** 
   1.130 +     * Parses XML file and builds DOM RXmlEngDocument
   1.131 +     *
   1.132 +     * @since S60 v3.2
   1.133 +	 * @param aFileName File name
   1.134 +     * @param aChunkSize Size of chunk (if 0 chunks won't be used)
   1.135 +     * @return Document handle
   1.136 +     * 
   1.137 +     * @leave KXmlEngErrParsing or one of general codes (e.g. KErrNoMemory)
   1.138 +     */
   1.139 +    IMPORT_C RXmlEngDocument ParseFileL(const TDesC& aFileName, TUint aChunkSize = 0);
   1.140 +
   1.141 +    /** 
   1.142 +     * Parses XML data from memory buffer and builds DOM RXmlEngDocument without chunks
   1.143 +     *
   1.144 +	 * @since S60 v3.1
   1.145 +	 * @param aBuffer XML data buffer
   1.146 +     * @return Document handle
   1.147 +     * 
   1.148 +     * @leave KXmlEngErrParsing code (besides system I/O error codes)
   1.149 +     */
   1.150 +    IMPORT_C RXmlEngDocument ParseL(const TDesC8& aBuffer);  
   1.151 +
   1.152 +    /** 
   1.153 +     * Return last parsing error code. 
   1.154 +     *
   1.155 +     * @since S60 v3.2
   1.156 +	 * @return positive number
   1.157 +     *
   1.158 +     * @note Error codes are positive numbers. User can find them
   1.159 +     *         in XmlEngDErrors.h
   1.160 +     */
   1.161 +    IMPORT_C TInt GetLastParsingError();
   1.162 +private:
   1.163 +    /** 
   1.164 +     * Parses XML file and builds DOM RXmlEngDocument without usage of chunks
   1.165 +     *
   1.166 +     * @param aRFs File server session
   1.167 +     * @param aFileName File name
   1.168 +     * @return Document handle
   1.169 +     * 
   1.170 +     * @leave KXmlEngErrParsing code (besides system I/O error codes)
   1.171 +	 */
   1.172 +    RXmlEngDocument ParseFileWithoutChunksL(RFs& aRFs, const TDesC& aFileName);
   1.173 +
   1.174 +    /** 
   1.175 +     * Cleanup internal data.
   1.176 +     *
   1.177 +     * @since S60 v3.2
   1.178 +     */
   1.179 +    void Cleanup();
   1.180 +private:
   1.181 +    void* iInternal;
   1.182 +    TInt iError;
   1.183 +    RXmlEngDOMImplementation* iImpl;
   1.184 +};
   1.185 +
   1.186 +
   1.187 +
   1.188 +#endif /* XMLENGINE_DOMPARSER_H_INCLUDED */