|
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 the License "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: Content handler for xml reader callbacks* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CIPTVCONTENTHANDLERBASE_H |
|
21 #define __CIPTVCONTENTHANDLERBASE_H |
|
22 |
|
23 // SYSTEM INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <xml/contenthandler.h> |
|
26 |
|
27 using namespace Xml; |
|
28 |
|
29 /** |
|
30 * Base class for content handling of xml parsing. |
|
31 * This class implemenets MContentHandler functions as |
|
32 * an empty implementations and derived classes needs to take |
|
33 * care of implementing those which are needed to fullfill |
|
34 * their requirements. |
|
35 * Most likely functions that needs to be overwritten are |
|
36 * OnStartElementL, OnEndElementL and OnContentL |
|
37 */ |
|
38 class CIptvContentHandlerBase : public CBase, |
|
39 public MContentHandler |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Destructor |
|
44 */ |
|
45 IMPORT_C virtual ~CIptvContentHandlerBase(); |
|
46 |
|
47 public: // From MContentHandler |
|
48 /** |
|
49 This method is a callback to indicate the start of the document. |
|
50 @param aDocParam Specifies the various parameters of the document. |
|
51 @param aDocParam.iCharacterSetName The character encoding of the document. |
|
52 @param aErrorCode is the error code. |
|
53 If this is not KErrNone then special action may be required. |
|
54 */ |
|
55 IMPORT_C void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode ); |
|
56 |
|
57 /** |
|
58 This method is a callback to indicate the end of the document. |
|
59 @param aErrorCode is the error code. |
|
60 If this is not KErrNone then special action may be required. |
|
61 */ |
|
62 IMPORT_C void OnEndDocumentL( TInt aErrorCode ); |
|
63 |
|
64 /** |
|
65 This method is a callback to indicate an element has been parsed. |
|
66 @param aElement is a handle to the element's details. |
|
67 @param aAttributes contains the attributes for the element. |
|
68 @param aErrorCode is the error code. |
|
69 If this is not KErrNone then special action may be required. |
|
70 */ |
|
71 IMPORT_C void OnStartElementL( const RTagInfo& aElement, |
|
72 const RAttributeArray& aAttributes, |
|
73 TInt aErrorCode ); |
|
74 |
|
75 /** |
|
76 This method is a callback to indicate the end of the element has been reached. |
|
77 @param aElement is a handle to the element's details. |
|
78 @param aErrorCode is the error code. |
|
79 If this is not KErrNone then special action may be required. |
|
80 */ |
|
81 IMPORT_C void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode ); |
|
82 |
|
83 /** |
|
84 This method is a callback that sends the content of the element. |
|
85 Not all the content may be returned in one go. The data may be sent in chunks. |
|
86 When an OnEndElementL is received this means there is no more content to be sent. |
|
87 @param aBytes is the raw content data for the element. |
|
88 The client is responsible for converting the data to the |
|
89 required character set if necessary. |
|
90 In some instances the content may be binary and must not be converted. |
|
91 @param aErrorCode is the error code. |
|
92 If this is not KErrNone then special action may be required. |
|
93 */ |
|
94 IMPORT_C void OnContentL( const TDesC8& aBytes, TInt aErrorCode ); |
|
95 |
|
96 /** |
|
97 This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. |
|
98 This method is always called before the corresponding OnStartElementL method. |
|
99 @param aPrefix is the Namespace prefix being declared. |
|
100 @param aUri is the Namespace URI the prefix is mapped to. |
|
101 @param aErrorCode is the error code. |
|
102 If this is not KErrNone then special action may be required. |
|
103 */ |
|
104 IMPORT_C void OnStartPrefixMappingL( const RString& aPrefix, |
|
105 const RString& aUri, |
|
106 TInt aErrorCode); |
|
107 |
|
108 /** |
|
109 This method is a notification of the end of the scope of a prefix-URI mapping. |
|
110 This method is called after the corresponding DoEndElementL method. |
|
111 @param aPrefix is the Namespace prefix that was mapped. |
|
112 @param aErrorCode is the error code. |
|
113 If this is not KErrNone then special action may be required. |
|
114 */ |
|
115 IMPORT_C void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode ); |
|
116 |
|
117 /** |
|
118 This method is a notification of ignorable whitespace in element content. |
|
119 @param aBytes are the ignored bytes from the document being parsed. |
|
120 @param aErrorCode is the error code. |
|
121 If this is not KErrNone then special action may be required. |
|
122 */ |
|
123 IMPORT_C void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode ); |
|
124 |
|
125 /** |
|
126 This method is a notification of a skipped entity. If the parser encounters an |
|
127 external entity it does not need to expand it - it can return the entity as aName |
|
128 for the client to deal with. |
|
129 @param aName is the name of the skipped entity. |
|
130 @param aErrorCode is the error code. |
|
131 If this is not KErrNone then special action may be required. |
|
132 */ |
|
133 IMPORT_C void OnSkippedEntityL( const RString& aName, TInt aErrorCode ); |
|
134 |
|
135 /** |
|
136 This method is a receive notification of a processing instruction. |
|
137 @param aTarget is the processing instruction target. |
|
138 @param aData is the processing instruction data. If empty none was supplied. |
|
139 @param aErrorCode is the error code. |
|
140 If this is not KErrNone then special action may be required. |
|
141 */ |
|
142 IMPORT_C void OnProcessingInstructionL( const TDesC8& aTarget, |
|
143 const TDesC8& aData, |
|
144 TInt aErrorCode); |
|
145 |
|
146 /** |
|
147 This method indicates an error has occurred. |
|
148 @param aError is the error code |
|
149 */ |
|
150 IMPORT_C void OnError( TInt aErrorCode ); |
|
151 |
|
152 /** |
|
153 This method obtains the interface matching the specified uid. |
|
154 @return 0 if no interface matching the uid is found. |
|
155 Otherwise, the this pointer cast to that interface. |
|
156 @param aUid the uid identifying the required interface. |
|
157 */ |
|
158 IMPORT_C TAny* GetExtendedInterface( const TInt32 aUid ); |
|
159 |
|
160 |
|
161 protected: |
|
162 /** |
|
163 * Default consturtor |
|
164 */ |
|
165 IMPORT_C CIptvContentHandlerBase(); |
|
166 |
|
167 /** |
|
168 * Symbian second phase constructor can contain code that might leave. |
|
169 * This function completes CIptvThomsonContentHandlerBase construction. |
|
170 * @param None |
|
171 * @return None |
|
172 */ |
|
173 IMPORT_C void BaseConstructL(); |
|
174 |
|
175 }; |
|
176 |
|
177 #endif // __CIptvThomsonContentHandlerBase_H |