|
1 /* |
|
2 * Copyright (c) 2000 - 2001 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** ----------------------------------------------------------------------- ** |
|
20 @package: NW_XML |
|
21 |
|
22 @synopsis: default |
|
23 |
|
24 @description: default |
|
25 |
|
26 ** ----------------------------------------------------------------------- **/ |
|
27 |
|
28 #ifndef NW_XMLPARSER_H |
|
29 #define NW_XMLPARSER_H |
|
30 |
|
31 #include <xml/cxml/nw_xmlp_xmlreader.h> |
|
32 |
|
33 #ifdef __cplusplus |
|
34 extern "C" { |
|
35 #endif /* __cplusplus */ |
|
36 |
|
37 |
|
38 /** ----------------------------------------------------------------------- ** |
|
39 @enum: NW_XML_PiFormTypeTag |
|
40 |
|
41 @synopsis: Process instruction type definitions. |
|
42 |
|
43 @scope: public |
|
44 @names: |
|
45 [UNKNOWFORM] |
|
46 Don't know what type it is. |
|
47 |
|
48 [PI] |
|
49 Process instruction. |
|
50 |
|
51 [XMLDECL] |
|
52 May be a TextDecl |
|
53 |
|
54 [XMLRESERVED] |
|
55 XML reserved. |
|
56 |
|
57 @description: Process instruction type definitions. |
|
58 ** ----------------------------------------------------------------------- **/ |
|
59 typedef enum NW_XML_PiFormTypeTag_e { |
|
60 UNKNOWFORM, |
|
61 PI, |
|
62 XMLDECL, |
|
63 XMLRESERVED |
|
64 } NW_XML_PiFormTypeTag_t; |
|
65 |
|
66 /* Deprecated - Lext in for backward compatibility. */ |
|
67 typedef enum NW_XML_PiFormTypeTag_e NW_PiFormTypeTag_t; |
|
68 |
|
69 /* RME documentation tools do not support function calls as variables yet */ |
|
70 |
|
71 /* * ----------------------------------------------------------------------- ** |
|
72 @struct: NW_XML_Parser_EventCallbacks |
|
73 |
|
74 @synopsis: default |
|
75 |
|
76 @scope: public |
|
77 @variables: |
|
78 NW_Status_t (*StartDocument_CB) (NW_XML_Reader_t*, void*) |
|
79 default |
|
80 |
|
81 NW_Status_t (*EndDocument_CB) (NW_XML_Reader_t*, void*) |
|
82 default |
|
83 |
|
84 NW_Status_t (*PiForm_CB) (NW_XML_Reader_t*, |
|
85 NW_XML_PiFormTypeTag_t piTypeTag, |
|
86 const NW_XML_Reader_Interval_t* pI_name, |
|
87 const NW_XML_Reader_Interval_t* pI_version, |
|
88 const NW_XML_Reader_Interval_t* pI_encoding, |
|
89 const NW_XML_Reader_Interval_t* pI_standalone, |
|
90 const NW_XML_Reader_Interval_t* pI_content, |
|
91 void*) |
|
92 default |
|
93 |
|
94 NW_Status_t (*Tag_Start_CB) (NW_XML_Reader_t*, |
|
95 const NW_XML_Reader_Interval_t* pI_name, |
|
96 void*) |
|
97 default |
|
98 |
|
99 NW_Status_t (*Tag_End_CB) (NW_XML_Reader_t*, |
|
100 const NW_XML_Reader_Interval_t* pI_name, |
|
101 NW_Uint32 emptyTagFlag, |
|
102 void*) |
|
103 default |
|
104 |
|
105 NW_Status_t (*Attr_Start_CB) (NW_XML_Reader_t*, |
|
106 const NW_XML_Reader_Interval_t* pI_name, |
|
107 void*) |
|
108 default |
|
109 |
|
110 NW_Status_t (*Attr_VarVal_CB) (NW_XML_Reader_t*, |
|
111 const NW_XML_Reader_Interval_t* pI_name, |
|
112 const NW_XML_Reader_Interval_t* pI_value, |
|
113 void*) |
|
114 default |
|
115 |
|
116 NW_Status_t (*Attributes_End_CB) (NW_XML_Reader_t*, NW_Uint32 attributeCount, |
|
117 void*) |
|
118 default |
|
119 |
|
120 NW_Status_t (*Cdata_CB) (NW_XML_Reader_t*, |
|
121 const NW_XML_Reader_Interval_t* pI_cdata, |
|
122 void*) |
|
123 default |
|
124 |
|
125 NW_Status_t (*Content_CB) (NW_XML_Reader_t*, |
|
126 const NW_XML_Reader_Interval_t* pI_cdata, |
|
127 void*) |
|
128 default |
|
129 |
|
130 NW_Status_t (*Comment_CB) (NW_XML_Reader_t*, |
|
131 const NW_XML_Reader_Interval_t* pI_comment, |
|
132 void*) |
|
133 default |
|
134 |
|
135 NW_Status_t (*Extension_CB) (NW_XML_Reader_t*, void*) |
|
136 default |
|
137 |
|
138 NW_Status_t (*Exception_CB) (NW_XML_Reader_t*, void*) |
|
139 default |
|
140 |
|
141 void* pClientPointer |
|
142 Passed back in each callback. |
|
143 |
|
144 @description: default |
|
145 ** ----------------------------------------------------------------------- **/ |
|
146 struct NW_XML_Parser_EventCallbacks_s |
|
147 { |
|
148 NW_Status_t (*StartDocument_CB) (NW_XML_Reader_t*, void*); |
|
149 NW_Status_t (*EndDocument_CB) (NW_XML_Reader_t*, void*); |
|
150 NW_Status_t (*PiForm_CB) (NW_XML_Reader_t*, |
|
151 NW_XML_PiFormTypeTag_t piTypeTag, |
|
152 const NW_XML_Reader_Interval_t* pI_name, |
|
153 const NW_XML_Reader_Interval_t* pI_version, |
|
154 const NW_XML_Reader_Interval_t* pI_encoding, |
|
155 const NW_XML_Reader_Interval_t* pI_standalone, |
|
156 const NW_XML_Reader_Interval_t* pI_content, |
|
157 void*); |
|
158 NW_Status_t (*Tag_Start_CB) (NW_XML_Reader_t*, |
|
159 const NW_XML_Reader_Interval_t* pI_name, |
|
160 void*); |
|
161 NW_Status_t (*Tag_End_CB) (NW_XML_Reader_t*, |
|
162 const NW_XML_Reader_Interval_t* pI_name, |
|
163 NW_Uint32 emptyTagFlag, |
|
164 void*); |
|
165 NW_Status_t (*Attr_Start_CB) (NW_XML_Reader_t*, |
|
166 const NW_XML_Reader_Interval_t* pI_name, |
|
167 void*); |
|
168 NW_Status_t (*Attr_VarVal_CB) (NW_XML_Reader_t*, |
|
169 const NW_XML_Reader_Interval_t* pI_name, |
|
170 const NW_XML_Reader_Interval_t* pI_value, |
|
171 void*); |
|
172 NW_Status_t (*Attributes_End_CB) (NW_XML_Reader_t*, NW_Uint32 attributeCount, |
|
173 void*); |
|
174 NW_Status_t (*Cdata_CB) (NW_XML_Reader_t*, |
|
175 const NW_XML_Reader_Interval_t* pI_cdata, |
|
176 void*); |
|
177 NW_Status_t (*Content_CB) (NW_XML_Reader_t*, |
|
178 const NW_XML_Reader_Interval_t* pI_cdata, |
|
179 void*); |
|
180 NW_Status_t (*Comment_CB) (NW_XML_Reader_t*, |
|
181 const NW_XML_Reader_Interval_t* pI_comment, |
|
182 void*); |
|
183 NW_Status_t (*Extension_CB) (NW_XML_Reader_t*, void*); |
|
184 |
|
185 NW_Status_t (*Exception_CB) (NW_XML_Reader_t*, void*); |
|
186 |
|
187 NW_Status_t (*Entity_CB) (NW_XML_Reader_t*, NW_Uint32 numEntity,void* ,CXML_Uint8* str); |
|
188 |
|
189 NW_Status_t (*Attr_Entity_VarVal_CB) (NW_XML_Reader_t* pT, |
|
190 const NW_XML_Reader_Interval_t* pI_name, |
|
191 NW_Uint8* pValue, |
|
192 NW_Uint32 valueByteLength, |
|
193 void* pV); |
|
194 |
|
195 void* pClientPointer; /* passed back in each callback*/ |
|
196 }; |
|
197 |
|
198 |
|
199 /** ----------------------------------------------------------------------- ** |
|
200 @function: NW_XML_Parse |
|
201 |
|
202 @synopsis: The XML main parser. |
|
203 |
|
204 @scope: public |
|
205 |
|
206 @parameters: |
|
207 [in] NW_XML_Reader_t* t |
|
208 The XML reader. |
|
209 |
|
210 [in] const struct NW_XML_Parser_EventCallbacks_s* pE |
|
211 The callbacks. |
|
212 |
|
213 @description: The XML main parser. Parses the entire document. |
|
214 |
|
215 @returns: NW_Status_t |
|
216 Status of operation. |
|
217 |
|
218 [NW_STAT_SUCCESS] |
|
219 Parsed the document. |
|
220 |
|
221 [NW_STAT_FAILURE] |
|
222 Failed somewhere along the way. |
|
223 |
|
224 ** ----------------------------------------------------------------------- **/ |
|
225 IMPORT_C NW_Status_t |
|
226 NW_XML_Parse(NW_XML_Reader_t* t, const struct NW_XML_Parser_EventCallbacks_s* pE); |
|
227 |
|
228 |
|
229 #ifdef __cplusplus |
|
230 } /* extern "C" { */ |
|
231 #endif /* __cplusplus */ |
|
232 |
|
233 |
|
234 #endif /* NW_XMLPARSER_H */ |