|
1 /* |
|
2 * Copyright (c) 2002 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CXMLOBSERVER_H |
|
21 #define __CXMLOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <txtetext.h> |
|
26 #include "CXMLAttributes.h" |
|
27 #include <xml/MXMLContentHandler.h> |
|
28 #include <xml/MWBXMLContentHandler.h> |
|
29 |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Help class for CXMLReader. |
|
35 * @lib XMLInterface.dll |
|
36 * @since ?Series60_version |
|
37 */ |
|
38 class CXMLObserver : public CBase |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 */ |
|
45 static CXMLObserver* NewL(); |
|
46 |
|
47 static CXMLObserver* NewLC(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CXMLObserver(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Registers content handler |
|
58 * @since ?Series60_version |
|
59 * @param aContentHandler: The ContentHandler to use. |
|
60 * @return none. |
|
61 */ |
|
62 inline void SetContentHandler(MXMLContentHandler* aContentHandler){iContentHandler = aContentHandler;} |
|
63 |
|
64 /** |
|
65 * Registers a binary content handler |
|
66 * @since ?Series60_version |
|
67 * @param aContentHandler: The ContentHandler to use. |
|
68 * @return none. |
|
69 */ |
|
70 inline void SetContentHandler(MWBXMLContentHandler* aContentHandler){iBinaryContentHandler = aContentHandler;} |
|
71 |
|
72 /** |
|
73 * Gets content handler |
|
74 * @since ?Series60_version |
|
75 * @param none. |
|
76 * @return ContentHandler. |
|
77 */ |
|
78 inline MXMLContentHandler* GetContentHandler(){return iContentHandler;} |
|
79 |
|
80 /** |
|
81 * Gets binary content handler |
|
82 * @since ?Series60_version |
|
83 * @param none. |
|
84 * @return ContentHandler. |
|
85 */ |
|
86 inline MWBXMLContentHandler* GetBinaryContentHandler(){return iBinaryContentHandler;} |
|
87 |
|
88 |
|
89 /** |
|
90 * Gets current attribute list |
|
91 * @since ?Series60_version |
|
92 * @return pointer to current attribute list |
|
93 */ |
|
94 inline CXMLAttributes* GetAttributes(){return iAttributes;} |
|
95 |
|
96 /** |
|
97 * Get current element |
|
98 * @since ?Series60_version |
|
99 * @return Current element |
|
100 */ |
|
101 TPtrC GetElement() const; |
|
102 |
|
103 /** |
|
104 * Set current element |
|
105 * @since ?Series60_version |
|
106 * @param Current element |
|
107 * @return none. |
|
108 */ |
|
109 void SetElementL(const TPtrC &aName); |
|
110 |
|
111 /** |
|
112 * Remove current element |
|
113 * @since ?Series60_version |
|
114 * @return none |
|
115 */ |
|
116 void RemoveElement(); |
|
117 |
|
118 /** |
|
119 * Set element URI |
|
120 * @since ?Series60_version |
|
121 * @param aURI: the URI. |
|
122 * @param aNSextension: namespace extension mapped to aURI. |
|
123 * @return none |
|
124 */ |
|
125 void SetURIL(const TPtrC &aURI, const TPtrC &aNSextension); |
|
126 |
|
127 /** |
|
128 * Get element URI |
|
129 * @since ?Series60_version |
|
130 * @param aNSextension: namespace extension mapped to aURI. |
|
131 * @return the URI. |
|
132 */ |
|
133 TPtrC GetURI(const TPtrC &aNSextension) const; |
|
134 |
|
135 /** |
|
136 * ResetURI, reset URI list |
|
137 * @since ?Series60_version |
|
138 * @return none. |
|
139 */ |
|
140 void ResetURI(); |
|
141 |
|
142 |
|
143 private: |
|
144 /** |
|
145 * C++ default constructor. |
|
146 */ |
|
147 CXMLObserver(); |
|
148 |
|
149 void ConstructL(); |
|
150 |
|
151 public: // Data |
|
152 // Keeps current attribute name |
|
153 TPtrC* iCurrentAttribute; |
|
154 |
|
155 private: // Data |
|
156 // Parser CallBacks |
|
157 MXMLContentHandler* iContentHandler; |
|
158 // Binary call backs |
|
159 MWBXMLContentHandler* iBinaryContentHandler; |
|
160 // Current attribute list |
|
161 CXMLAttributes* iAttributes; |
|
162 // Keeps track of elements (needed for binary parsing) |
|
163 CDesCArraySeg* iDescElements; |
|
164 |
|
165 // Keep track off namespace extensions and URIs. |
|
166 CDesCArraySeg* iNSextensions; |
|
167 CDesCArraySeg* iURIs; |
|
168 }; |
|
169 |
|
170 #endif // __CXMLOBSERVER_H |
|
171 |
|
172 // End of File |