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_WBXML |
|
21 |
|
22 @synopsis: default |
|
23 |
|
24 @description: Definitions for WBXML low-level event handling. |
|
25 |
|
26 ** ----------------------------------------------------------------------- **/ |
|
27 |
|
28 #ifndef NW_PARSER_WBXML_EVENT_H |
|
29 #define NW_PARSER_WBXML_EVENT_H |
|
30 |
|
31 #include <xml/cxml/nw_wbxml_document.h> |
|
32 #include <xml/cxml/cxml_proj.h> |
|
33 |
|
34 #ifdef __cplusplus |
|
35 extern "C" { |
|
36 #endif /* __cplusplus */ |
|
37 |
|
38 typedef struct NW_WBXML_Parser_s NW_WBXML_Parser_t; |
|
39 |
|
40 |
|
41 /** ----------------------------------------------------------------------- ** |
|
42 @typedef: NW_WBXML_Exception |
|
43 |
|
44 @synopsis: Exception identifier. |
|
45 |
|
46 @scope: public |
|
47 @type: NW_Int32 |
|
48 |
|
49 @description: Exception identifier. |
|
50 ** ----------------------------------------------------------------------- **/ |
|
51 typedef NW_Int32 NW_WBXML_Exception_t; |
|
52 |
|
53 /* No RME doc support for function calls as variables */ |
|
54 |
|
55 struct NW_WBXML_EventHandler_s { |
|
56 |
|
57 /* State change events */ |
|
58 |
|
59 NW_Status_t (*StartDocument_CB) (NW_WBXML_Parser_t *, |
|
60 NW_WBXML_Document_t *, |
|
61 void *); |
|
62 |
|
63 NW_Status_t (*EndDocument_CB) (NW_WBXML_Parser_t *, |
|
64 void *); |
|
65 |
|
66 NW_Status_t (*Pi_CB) (NW_WBXML_Parser_t *, |
|
67 void *); |
|
68 |
|
69 NW_Status_t (*Pi_End_CB) (NW_WBXML_Parser_t *, |
|
70 void *); |
|
71 |
|
72 NW_Status_t (*Tag_Start_CB) (NW_WBXML_Parser_t *, |
|
73 void *); |
|
74 |
|
75 NW_Status_t (*Tag_End_CB) (NW_WBXML_Parser_t *, |
|
76 void *); |
|
77 |
|
78 NW_Status_t (*Attr_Start_CB) (NW_WBXML_Parser_t *, |
|
79 void *); |
|
80 |
|
81 NW_Status_t (*Attr_Val_CB) (NW_WBXML_Parser_t *, |
|
82 void *); |
|
83 |
|
84 NW_Status_t (*Content_CB) (NW_WBXML_Parser_t *, |
|
85 void *); |
|
86 |
|
87 NW_Status_t (*CodePage_CB) (NW_WBXML_Parser_t *, |
|
88 void *); |
|
89 |
|
90 NW_Status_t (*Extension_CB) (NW_WBXML_Parser_t *, |
|
91 void *); |
|
92 |
|
93 /* Handle data types */ |
|
94 |
|
95 NW_Status_t (*Token_CB) (NW_WBXML_Parser_t *, |
|
96 NW_Uint8, |
|
97 void *); |
|
98 |
|
99 NW_Status_t (*FQToken_CB)(NW_WBXML_Parser_t *, |
|
100 NW_Uint32, |
|
101 void *); |
|
102 |
|
103 NW_Status_t (*InlineString_CB) (NW_WBXML_Parser_t *, |
|
104 NW_Uint32, |
|
105 void *); |
|
106 |
|
107 NW_Status_t (*TableString_CB) (NW_WBXML_Parser_t *, |
|
108 NW_Uint32, |
|
109 void *); |
|
110 |
|
111 NW_Status_t (*Binary_CB) (NW_WBXML_Parser_t *, |
|
112 NW_Uint32, |
|
113 void *); |
|
114 |
|
115 NW_Status_t (*Opaque_CB) (NW_WBXML_Parser_t *, |
|
116 NW_Uint32, |
|
117 void *); |
|
118 |
|
119 NW_Status_t (*Entity_CB) (NW_WBXML_Parser_t *, |
|
120 NW_Uint32, |
|
121 void *); |
|
122 |
|
123 /* For parse errors */ |
|
124 |
|
125 NW_Status_t (*Exception_CB) (NW_WBXML_Parser_t *, |
|
126 NW_WBXML_Exception_t, |
|
127 void *); |
|
128 }; |
|
129 |
|
130 |
|
131 /** ----------------------------------------------------------------------- ** |
|
132 @typedef: NW_WBXML_EventHandler |
|
133 |
|
134 @synopsis: Parsing event handler structure. |
|
135 |
|
136 @scope: public |
|
137 @type: NW_WBXML_EventHandler_s |
|
138 |
|
139 @description: Parsing events are generated as the parser parses a |
|
140 document. The interface is currently implemented by |
|
141 the WBXML parser, but the XML parser will use the same |
|
142 event interface, although not all of the events will |
|
143 be generated by both parsers. To create an event |
|
144 handler, an application implements a set of event |
|
145 handler functions and creates an |
|
146 NMXB_Parse_EventHandler_t structure that contains the |
|
147 addresses of these functions. Not all of the events |
|
148 need to be handled; an application need only provide |
|
149 handlers for those events it is interested in |
|
150 Addresses of the other handlers should be set to |
|
151 NULL. |
|
152 This data type contains addresses of the parser |
|
153 callback functions. To use the parser event interface, |
|
154 the caller must implement a set of handlers and |
|
155 initialize a NMXB_Parser_EventHandler_t to point to |
|
156 them. Addresses must be set to NULL for any handlers |
|
157 not implemented. The caller then registers the handler |
|
158 with the parser by calling the appropriate handler |
|
159 registration function. The callbacks are divided |
|
160 between "state" callbacks and "data" callbacks. The |
|
161 state callbacks indicate the current parser state: |
|
162 that is, what type of element it is currently |
|
163 parsing. The data callbacks indicate a specific data |
|
164 type for the currently parsed element. |
|
165 |
|
166 ** ----------------------------------------------------------------------- **/ |
|
167 typedef struct NW_WBXML_EventHandler_s NW_WBXML_EventHandler_t; |
|
168 |
|
169 |
|
170 #ifdef __cplusplus |
|
171 } /* extern "C" { */ |
|
172 #endif /* __cplusplus */ |
|
173 |
|
174 #endif /* NW_PARSER_WBXML_EVENT_H */ |
|