|
1 /* |
|
2 * Copyright (c) 2007-2008 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 "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: Parser for Oma Drm 2.1 WBXML RoapTrigger messages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef WBXMLROAPTRIGGERPARSER_H |
|
21 #define WBXMLROAPTRIGGERPARSER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <xml/parser.h> |
|
25 #include <xml/contenthandler.h> |
|
26 #include <xml/xmlparsererrors.h> |
|
27 |
|
28 namespace DRM |
|
29 { |
|
30 |
|
31 NONSHARABLE_CLASS( CWbxmlRoapTriggerParser ): public CBase, public Xml::MContentHandler |
|
32 { |
|
33 |
|
34 public: // Constructors and destructor |
|
35 |
|
36 /** |
|
37 * Two-phased constructor. |
|
38 */ |
|
39 IMPORT_C static CWbxmlRoapTriggerParser* NewL(); |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 */ |
|
44 IMPORT_C static CWbxmlRoapTriggerParser* NewLC(); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 IMPORT_C virtual ~CWbxmlRoapTriggerParser(); |
|
50 |
|
51 /** |
|
52 * Parses the WBXML RoapTrigger to XML |
|
53 * |
|
54 * @param aMessage WBXML RoapTrigger to be parsed |
|
55 * |
|
56 * @return parsed XML RoapTrigger in HBufC8 |
|
57 */ |
|
58 IMPORT_C HBufC8* ParseL( const TDesC8& aMessage ); |
|
59 |
|
60 public: // Functions from base classes |
|
61 |
|
62 /** |
|
63 * From MContentHandler |
|
64 * |
|
65 * @param aDocParam Specifies the various parameters of the document. |
|
66 * @arg aDocParam.iCharacterSetName The character encoding of the document. |
|
67 * @param aErrorCode is the error code. |
|
68 * If this is not KErrNone then special action may be required. |
|
69 */ |
|
70 void OnStartDocumentL( const Xml::RDocumentParameters& aDocParam, |
|
71 TInt aErrorCode ); |
|
72 |
|
73 /** |
|
74 * From MContentHandler |
|
75 * |
|
76 * @param aErrorCode is the error code. |
|
77 * If this is not KErrNone then special action may be required. |
|
78 */ |
|
79 void OnEndDocumentL( TInt aErrorCode); |
|
80 |
|
81 /** |
|
82 * From MContentHandler |
|
83 * |
|
84 * @param aElement is a handle to the element's details. |
|
85 * @param aAttributes contains the attributes for the element. |
|
86 * @param aErrorCode is the error code. |
|
87 * If this is not KErrNone then special action may be required. |
|
88 */ |
|
89 void OnStartElementL( const Xml::RTagInfo& aElement, |
|
90 const Xml::RAttributeArray& aAttributes, |
|
91 TInt aErrorCode ); |
|
92 |
|
93 /** |
|
94 * From MContentHandler |
|
95 * |
|
96 * @param aElement is a handle to the element's details. |
|
97 * @param aErrorCode is the error code. |
|
98 * If this is not KErrNone then special action may be required. |
|
99 */ |
|
100 void OnEndElementL( const Xml::RTagInfo& aElement, |
|
101 TInt aErrorCode ); |
|
102 |
|
103 /** |
|
104 * From MContentHandler |
|
105 * |
|
106 * @param aBytes is the raw content data for the element. |
|
107 * The client is responsible for converting the data to the |
|
108 * required character set if necessary. |
|
109 * In some instances the content may be binary and must not be converted. |
|
110 * @param aErrorCode is the error code. |
|
111 * If this is not KErrNone then special action may be required. |
|
112 */ |
|
113 void OnContentL( const TDesC8& aBytes, |
|
114 TInt aErrorCode ); |
|
115 |
|
116 /** |
|
117 * From MContentHandler |
|
118 * |
|
119 * @param aPrefix is the Namespace prefix being declared. |
|
120 * @param aUri is the Namespace URI the prefix is mapped to. |
|
121 * @param aErrorCode is the error code. |
|
122 * If this is not KErrNone then special action may be required. |
|
123 */ |
|
124 void OnStartPrefixMappingL( const RString& aPrefix, |
|
125 const RString& aUri, |
|
126 TInt aErrorCode ); |
|
127 |
|
128 /** |
|
129 * From MContentHandler |
|
130 * |
|
131 * @param aPrefix is the Namespace prefix that was mapped. |
|
132 * @param aErrorCode is the error code. |
|
133 * If this is not KErrNone then special action may be required. |
|
134 */ |
|
135 void OnEndPrefixMappingL( const RString& aPrefix, |
|
136 TInt aErrorCode ); |
|
137 |
|
138 /** |
|
139 * From MContentHandler |
|
140 * |
|
141 * @param aBytes are the ignored bytes from the document being parsed. |
|
142 * @param aErrorCode is the error code. |
|
143 * If this is not KErrNone then special action may be required. |
|
144 */ |
|
145 void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, |
|
146 TInt aErrorCode ); |
|
147 |
|
148 /** |
|
149 * From MContentHandler |
|
150 * |
|
151 * @param aName is the name of the skipped entity. |
|
152 * @param aErrorCode is the error code. |
|
153 * If this is not KErrNone then special action may be required. |
|
154 */ |
|
155 void OnSkippedEntityL( const RString& aName, |
|
156 TInt aErrorCode ); |
|
157 |
|
158 /** |
|
159 * From MContentHandler |
|
160 * |
|
161 * @param aTarget is the processing instruction target. |
|
162 * @param aData is the processing instruction data. If empty none was supplied. |
|
163 * @param aErrorCode is the error code. |
|
164 * If this is not KErrNone then special action may be required. |
|
165 */ |
|
166 void OnProcessingInstructionL( const TDesC8& aTarget, |
|
167 const TDesC8& aData, |
|
168 TInt aErrorCode ); |
|
169 |
|
170 /** |
|
171 * From MContentHandler |
|
172 */ |
|
173 void OnOutOfData(); |
|
174 |
|
175 /** |
|
176 * From MContentHandler |
|
177 * |
|
178 * @param aError is the error code |
|
179 */ |
|
180 void OnError( TInt aErrorCode ); |
|
181 |
|
182 /** |
|
183 * From MContentHandler |
|
184 * |
|
185 * @param aUid the uid identifying the required interface. |
|
186 * |
|
187 * @return 0 if no interface matching the uid is found. |
|
188 * Otherwise, the this pointer cast to that interface. |
|
189 */ |
|
190 TAny* GetExtendedInterface( const TInt32 aUid ); |
|
191 |
|
192 private: // Functions from base classes |
|
193 |
|
194 /** |
|
195 * C++ default constructor. |
|
196 */ |
|
197 CWbxmlRoapTriggerParser(); |
|
198 |
|
199 /** |
|
200 * Symbian 2nd phase constructor. |
|
201 */ |
|
202 void ConstructL(); |
|
203 |
|
204 private: // Data |
|
205 |
|
206 Xml::CParser* iParser; |
|
207 CBufFlat* iContent; |
|
208 |
|
209 }; |
|
210 } |
|
211 |
|
212 #endif // WBXMLROAPTRIGGERPARSER_H |
|
213 |
|
214 // End of File |