williamr@2: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __CONTENTHANDLER_H__ williamr@2: #define __CONTENTHANDLER_H__ williamr@2: williamr@2: williamr@2: #include // needed for RAttributeArray williamr@2: williamr@2: class RString; williamr@2: williamr@2: namespace Xml williamr@2: { williamr@2: williamr@2: class RDocumentParameters; williamr@2: class RTagInfo; williamr@2: williamr@2: williamr@2: class MContentHandler williamr@2: /** williamr@2: This class defines the interface required by a client of the xml framework. williamr@2: It allows a client to be placed in a chain with other clients, i.e. a Parser, a Validator, williamr@2: or a User, and therefore allows the flow of information between these links. williamr@2: It provides callbacks analogous to that of the SAX 2.0 interface. williamr@2: @see http://www.saxproject.org/apidoc/ williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: This method is a callback to indicate the start of the document. williamr@2: @param aDocParam Specifies the various parameters of the document. williamr@2: @param aDocParam.iCharacterSetName The character encoding of the document. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a callback to indicate the end of the document. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnEndDocumentL(TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a callback to indicate an element has been parsed. williamr@2: @param aElement is a handle to the element's details. williamr@2: @param aAttributes contains the attributes for the element. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, williamr@2: TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a callback to indicate the end of the element has been reached. williamr@2: @param aElement is a handle to the element's details. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a callback that sends the content of the element. williamr@2: Not all the content may be returned in one go. The data may be sent in chunks. williamr@2: When an OnEndElementL is received this means there is no more content to be sent. williamr@2: @param aBytes is the raw content data for the element. williamr@2: The client is responsible for converting the data to the williamr@2: required character set if necessary. williamr@2: In some instances the content may be binary and must not be converted. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. williamr@2: This method is always called before the corresponding OnStartElementL method. williamr@2: @param aPrefix is the Namespace prefix being declared. williamr@2: @param aUri is the Namespace URI the prefix is mapped to. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, williamr@2: TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a notification of the end of the scope of a prefix-URI mapping. williamr@2: This method is called after the corresponding DoEndElementL method. williamr@2: @param aPrefix is the Namespace prefix that was mapped. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a notification of ignorable whitespace in element content. williamr@2: @param aBytes are the ignored bytes from the document being parsed. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a notification of a skipped entity. If the parser encounters an williamr@2: external entity it does not need to expand it - it can return the entity as aName williamr@2: for the client to deal with. williamr@2: @param aName is the name of the skipped entity. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method is a receive notification of a processing instruction. williamr@2: @param aTarget is the processing instruction target. williamr@2: @param aData is the processing instruction data. If empty none was supplied. williamr@2: @param aErrorCode is the error code. williamr@2: If this is not KErrNone then special action may be required. williamr@2: */ williamr@2: virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, williamr@2: TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method indicates an error has occurred. williamr@2: @param aErrorCode is the error code williamr@2: */ williamr@2: virtual void OnError(TInt aErrorCode) = 0; williamr@2: williamr@2: williamr@2: /** williamr@2: This method obtains the interface matching the specified uid. williamr@2: @return 0 if no interface matching the uid is found. williamr@2: Otherwise, the this pointer cast to that interface. williamr@2: @param aUid the uid identifying the required interface. williamr@2: */ williamr@2: virtual TAny* GetExtendedInterface(const TInt32 aUid) = 0; williamr@2: williamr@2: }; williamr@2: williamr@2: } williamr@2: williamr@2: williamr@2: #endif //__CONTENTHANDLER_H__