1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/xmllib.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,234 @@
1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// CXmlLibrary is an interface class for a client to access the Xml parsing and validation
1.18 +// services provided by the library. In general, CXmlLibrary should be concidered as a base
1.19 +// class for a library which implements the language specific bits of an Xml-language parser.
1.20 +// USAGE:
1.21 +// - Construction of the class using NewL or NewL
1.22 +// - Pass data to parsing by calling ProcessDataL.
1.23 +// - When all data has been parsed, call CommitL
1.24 +//
1.25 +//
1.26 +
1.27 +#ifndef __XMLLIB_H__
1.28 +#define __XMLLIB_H__
1.29 +
1.30 +// System includes
1.31 +//
1.32 +#include <e32base.h>
1.33 +#include <wapengstd.h>
1.34 +
1.35 +// CONSTANT DEFINITIONS
1.36 +//
1.37 +
1.38 +/**
1.39 +ID for the root node attribute that contains the buffered document in case no DTD was available
1.40 +@publishedAll
1.41 +@deprecated
1.42 +*/
1.43 +_LIT(KXmlLibBufferedDocumentAttribute, "XmlLibBufferedDocument");
1.44 +
1.45 +/**
1.46 +The Xml version that XML currently parser supports
1.47 +@publishedAll
1.48 +@deprecated
1.49 +*/
1.50 +_LIT(KSupportedXmlVersion, "1.0");
1.51 +
1.52 +/**
1.53 +ID for node containing text data defined in a CDATA section (i.e. within <![CDATA[ .. ]]> )
1.54 +@publishedAll
1.55 +@deprecated
1.56 +*/
1.57 +_LIT(KCDataID, "CDATA");
1.58 +
1.59 +/**
1.60 +ID for "normal" text nodes
1.61 +@publishedAll
1.62 +@deprecated
1.63 +*/
1.64 +_LIT(KPCDataID, "#PCDATA");
1.65 +
1.66 +
1.67 +// Forward class declarations
1.68 +//
1.69 +class CXmlElement;
1.70 +class CXmlParser;
1.71 +class CBNFNode;
1.72 +class CAttributeLookupTable;
1.73 +class MWapPluginSP;
1.74 +
1.75 +// CXmlLibrary
1.76 +//
1.77 +//##ModelId=3B6679A401C8
1.78 +class CXmlLibrary : public CBase
1.79 +/**
1.80 +@publishedAll
1.81 +@deprecated
1.82 +*/
1.83 + {
1.84 +public: // Methods
1.85 + // Default constuctor
1.86 + // Sets default values values iMIMEType, iDefaultDoctype and iDefaultDTDUrl
1.87 + // An inheriting class should override this constructor and set the variables
1.88 + // with their correct values.
1.89 + //##ModelId=3B6679A402CD
1.90 + IMPORT_C virtual ~CXmlLibrary();
1.91 + //##ModelId=3B6679A402BA
1.92 + IMPORT_C static CXmlLibrary* NewL(MWapPluginSP& aPluginSP, CXmlElement* aRootNode);
1.93 + //##ModelId=3B6679A402AF
1.94 + IMPORT_C static CXmlLibrary* NewLC(MWapPluginSP& aPluginSP, CXmlElement* aRootNode);
1.95 +
1.96 + //##ModelId=3B6679A40287
1.97 + IMPORT_C virtual TInt ProcessDataL(TDesC8& aData);
1.98 +
1.99 + // Xml Parse given data and generate document tree to the given root node.
1.100 + // INPUT:
1.101 + // aData - document text, or a piece of it
1.102 + // RETURN:
1.103 + // TInt - an error code defined above, KErrNone if no errors.
1.104 + //##ModelId=3B6679A40291
1.105 + IMPORT_C virtual TInt ProcessDataL(HBufC8& aData);
1.106 +
1.107 + // Signal parser that incoming data stream has finished
1.108 + // RETURN:
1.109 + // TInt - an error code defined above, KErrNone if no error occured.
1.110 + // NOTE: In case no DTD was available, the document got buffered and was attached
1.111 + // to an attribute in the root node and CommitL returns KErrDocumentBuffered.
1.112 + // The buffered document will be re-parsed when engine receives the requested
1.113 + // DTD and calls a data handler (defined by iMIMEType) for validation.
1.114 + //##ModelId=3B6679A4027E
1.115 + IMPORT_C virtual TInt CommitL();
1.116 +
1.117 + // Validate the document according to the given DTD.
1.118 + // INPUT:
1.119 + // aDTDRootNode - Root node to the DTD tree which defines the structure of the document.
1.120 + // This referenced node is the DTD root node created by the engine.
1.121 + // The actual DTD tree, if any, is attached as a child to this node.
1.122 + // NO INHERITING CLASS SHOULD OVERRIDE THIS! Override the protected
1.123 + // ValidateL instead.
1.124 + // RETURN:
1.125 + // TInt - an error code defining the reason for validation failure. KErrNone if no errors.
1.126 + //##ModelId=3B6679A40274
1.127 + IMPORT_C virtual TInt ValidateL(CBNFNode& aDTDRootNode);
1.128 +
1.129 + // Set parser and library to its initial state to start parsing of a new document
1.130 + // INPUT:
1.131 + // aRootNode - root node for the new document tree
1.132 + //##ModelId=3B6679A4026B
1.133 + IMPORT_C virtual void ResetL(CXmlElement* aRootNode);
1.134 +
1.135 + // -----------------------------------------------------------------------
1.136 + // (WAP Push Addition)
1.137 + // Wap Push specific method to switch off use of XML validator which doesn't work
1.138 + // with push messages.
1.139 + // iIgnoreValidator will be set on class construction to False with complies with
1.140 + // current code usage; for push messages ONLY set iIgnoreValidator to True
1.141 + // -----------------------------------------------------------------------
1.142 +// inline void OmitValidator(TBool aIgnoreValidator) { iIgnoreValidator = aIgnoreValidator; } ;
1.143 + //
1.144 + // -----------------------------------------------------------------------
1.145 +
1.146 +protected:
1.147 + // A simple, internal utility function to setup the Xml parser
1.148 + //##ModelId=3B6679A4026A
1.149 + IMPORT_C void PrepareParserL();
1.150 +
1.151 + //##ModelId=3B6679A40269
1.152 + IMPORT_C void ConstructL();
1.153 +
1.154 + // Default constructor
1.155 + // SEE NOTES ON iMimeType, iDefaultDocType and iDefaultDTDUrl for inheriting class's constuctor
1.156 + IMPORT_C CXmlLibrary(MWapPluginSP& aPluginSP, CXmlElement* aRootNode);
1.157 +
1.158 + // Data parsing method for internal usage. Takes ownership of the given data
1.159 + // INPUT:
1.160 + // aData - Pointer to the UNICODE text data. Parser shall take ownership of this data!
1.161 + // RETURN:
1.162 + // TInt - Error code, KErrNone if no errors.
1.163 + //##ModelId=3B6679A402A5
1.164 + TInt ProcessDataL(HBufC16* aData);
1.165 +
1.166 + // Internal utility function for finishing with the parser
1.167 + // RETURN:
1.168 + // TInt - Error code. KErrNone if no errors.
1.169 + //##ModelId=3B6679A40260
1.170 + TInt CommitParserL();
1.171 +
1.172 + // Internal utility function for handling return values from parsing and initiating DTD fetch
1.173 + // RETURN:
1.174 + // TInt - Error code. KErrNone if no errors.
1.175 + //##ModelId=3B6679A4025F
1.176 + TInt ExecuteDataProcessingL();
1.177 +
1.178 + //##ModelId=3B6679A40255
1.179 + CBNFNode* ExtractDTDTree(CBNFNode* aDTDRoot);
1.180 +
1.181 + // Internal validation function that actually performs the validation.
1.182 + // INPUT:
1.183 + // aDTDRootNode - Pointer to the _actual_ dtd tree root node, NOT the root given by angine
1.184 + // OUTPUT:
1.185 + // TInt - Error code, KErrNone if no errors
1.186 + //##ModelId=3B6679A4024B
1.187 + IMPORT_C virtual TInt ExecuteValidateL(CBNFNode* aDTDRootNode);
1.188 +
1.189 +protected: // Attributes
1.190 +
1.191 + /** Plugin Service Provider
1.192 + */
1.193 + //##ModelId=3B6679A40239
1.194 + MWapPluginSP& iPluginSP;
1.195 +
1.196 + /** Document Root Node
1.197 + */
1.198 + //##ModelId=3B6679A40225
1.199 + CXmlElement* iRootNode;
1.200 +
1.201 + // The default DTD doctype and Url in case no DTD was defined
1.202 + // NOTE: Inheriting class should set these values in its constructor!!
1.203 + //##ModelId=3B6679A4021B
1.204 + const TDesC* iDefaultDoctype;
1.205 +
1.206 + //##ModelId=3B6679A40211
1.207 + const TDesC* iDefaultDTDUrl;
1.208 +
1.209 + /** The actual DTD tree - not owned
1.210 + */
1.211 + //##ModelId=3B6679A401FC
1.212 + CBNFNode* iDTD;
1.213 +
1.214 +private: // Attributes
1.215 +
1.216 + /** The XML parser
1.217 + */
1.218 + //##ModelId=3B6679A401F2
1.219 + CXmlParser* iParser;
1.220 +
1.221 +private: // BC-proofing
1.222 +
1.223 +/**
1.224 + Intended Usage : Reserved for future use
1.225 + @since 6.0
1.226 + */
1.227 + //##ModelId=3B6679A40241
1.228 + IMPORT_C virtual void CXmlLibrary_Reserved1();
1.229 +
1.230 + /** Reserved for future use
1.231 + */
1.232 + //##ModelId=3B6679A401E8
1.233 + TAny* iCXmlLibrary_Reserved;
1.234 +
1.235 + };
1.236 +
1.237 +#endif // __XMLLIB_H__