|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CONTENTHANDLER_H__ |
|
17 #define __CONTENTHANDLER_H__ |
|
18 |
|
19 |
|
20 #include <xml/attribute.h> // needed for RAttributeArray |
|
21 |
|
22 class RString; |
|
23 |
|
24 namespace Xml |
|
25 { |
|
26 |
|
27 class RDocumentParameters; |
|
28 class RTagInfo; |
|
29 |
|
30 |
|
31 class MContentHandler |
|
32 /** |
|
33 This class defines the interface required by a client of the xml framework. |
|
34 It allows a client to be placed in a chain with other clients, i.e. a Parser, a Validator, |
|
35 or a User, and therefore allows the flow of information between these links. |
|
36 It provides callbacks analogous to that of the SAX 2.0 interface. |
|
37 @see http://www.saxproject.org/apidoc/ |
|
38 |
|
39 @publishedAll |
|
40 @released |
|
41 */ |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 This method is a callback to indicate the start of the document. |
|
47 @param aDocParam Specifies the various parameters of the document. |
|
48 @param aDocParam.iCharacterSetName The character encoding of the document. |
|
49 @param aErrorCode is the error code. |
|
50 If this is not KErrNone then special action may be required. |
|
51 */ |
|
52 virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode) = 0; |
|
53 |
|
54 |
|
55 /** |
|
56 This method is a callback to indicate the end of the document. |
|
57 @param aErrorCode is the error code. |
|
58 If this is not KErrNone then special action may be required. |
|
59 */ |
|
60 virtual void OnEndDocumentL(TInt aErrorCode) = 0; |
|
61 |
|
62 |
|
63 /** |
|
64 This method is a callback to indicate an element has been parsed. |
|
65 @param aElement is a handle to the element's details. |
|
66 @param aAttributes contains the attributes for the element. |
|
67 @param aErrorCode is the error code. |
|
68 If this is not KErrNone then special action may be required. |
|
69 */ |
|
70 virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, |
|
71 TInt aErrorCode) = 0; |
|
72 |
|
73 |
|
74 /** |
|
75 This method is a callback to indicate the end of the element has been reached. |
|
76 @param aElement is a handle to the element's details. |
|
77 @param aErrorCode is the error code. |
|
78 If this is not KErrNone then special action may be required. |
|
79 */ |
|
80 virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode) = 0; |
|
81 |
|
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 virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode) = 0; |
|
95 |
|
96 |
|
97 /** |
|
98 This method is a notification of the beginning of the scope of a prefix-URI Namespace mapping. |
|
99 This method is always called before the corresponding OnStartElementL method. |
|
100 @param aPrefix is the Namespace prefix being declared. |
|
101 @param aUri is the Namespace URI the prefix is mapped to. |
|
102 @param aErrorCode is the error code. |
|
103 If this is not KErrNone then special action may be required. |
|
104 */ |
|
105 virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, |
|
106 TInt aErrorCode) = 0; |
|
107 |
|
108 |
|
109 /** |
|
110 This method is a notification of the end of the scope of a prefix-URI mapping. |
|
111 This method is called after the corresponding DoEndElementL method. |
|
112 @param aPrefix is the Namespace prefix that was mapped. |
|
113 @param aErrorCode is the error code. |
|
114 If this is not KErrNone then special action may be required. |
|
115 */ |
|
116 virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode) = 0; |
|
117 |
|
118 |
|
119 /** |
|
120 This method is a notification of ignorable whitespace in element content. |
|
121 @param aBytes are the ignored bytes from the document being parsed. |
|
122 @param aErrorCode is the error code. |
|
123 If this is not KErrNone then special action may be required. |
|
124 */ |
|
125 virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode) = 0; |
|
126 |
|
127 |
|
128 /** |
|
129 This method is a notification of a skipped entity. If the parser encounters an |
|
130 external entity it does not need to expand it - it can return the entity as aName |
|
131 for the client to deal with. |
|
132 @param aName is the name of the skipped entity. |
|
133 @param aErrorCode is the error code. |
|
134 If this is not KErrNone then special action may be required. |
|
135 */ |
|
136 virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode) = 0; |
|
137 |
|
138 |
|
139 /** |
|
140 This method is a receive notification of a processing instruction. |
|
141 @param aTarget is the processing instruction target. |
|
142 @param aData is the processing instruction data. If empty none was supplied. |
|
143 @param aErrorCode is the error code. |
|
144 If this is not KErrNone then special action may be required. |
|
145 */ |
|
146 virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, |
|
147 TInt aErrorCode) = 0; |
|
148 |
|
149 |
|
150 /** |
|
151 This method indicates an error has occurred. |
|
152 @param aErrorCode is the error code |
|
153 */ |
|
154 virtual void OnError(TInt aErrorCode) = 0; |
|
155 |
|
156 |
|
157 /** |
|
158 This method obtains the interface matching the specified uid. |
|
159 @return 0 if no interface matching the uid is found. |
|
160 Otherwise, the this pointer cast to that interface. |
|
161 @param aUid the uid identifying the required interface. |
|
162 */ |
|
163 virtual TAny* GetExtendedInterface(const TInt32 aUid) = 0; |
|
164 |
|
165 }; |
|
166 |
|
167 } |
|
168 |
|
169 |
|
170 #endif //__CONTENTHANDLER_H__ |