|
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: Wbxml token definitions |
|
25 |
|
26 ** ----------------------------------------------------------------------- **/ |
|
27 |
|
28 #ifndef NW_PARSER_WBXML_PARSE_H |
|
29 #define NW_PARSER_WBXML_PARSE_H |
|
30 |
|
31 #include <xml/cxml/cxml_proj.h> |
|
32 #include <xml/cxml/nw_wbxml_token.h> |
|
33 #include <xml/cxml/nw_wbxml_event.h> |
|
34 |
|
35 #ifdef __cplusplus |
|
36 extern "C" { |
|
37 #endif /* __cplusplus */ |
|
38 |
|
39 |
|
40 /** ----------------------------------------------------------------------- ** |
|
41 @struct: NW_WBXML_CP_Registry_Entry |
|
42 |
|
43 @synopsis: Registry entry. |
|
44 |
|
45 @scope: public |
|
46 @variables: |
|
47 NW_Uint8 code_page |
|
48 The code page. |
|
49 |
|
50 NW_Uint32 start_offset |
|
51 Start offset. |
|
52 |
|
53 @description: Each entry must record if it is for tokens or attributes. |
|
54 A trick to encode this without extra memory relies on the |
|
55 use of two bytes in WBXML to encode a page switch. With two |
|
56 bytes one has an even offset and one an odd offset. We pick |
|
57 the even if it is a tag page and the odd offset if it is an |
|
58 attribute page. |
|
59 ** ----------------------------------------------------------------------- **/ |
|
60 typedef struct NW_WBXML_CP_Registry_Entry_s{ |
|
61 NW_Uint8 code_page; |
|
62 NW_Uint32 start_offset; |
|
63 }NW_WBXML_CP_Registry_Entry_t; |
|
64 |
|
65 |
|
66 /** ----------------------------------------------------------------------- ** |
|
67 @struct: NW_WBXML_CP_Registry |
|
68 |
|
69 @synopsis: The code page registry. |
|
70 |
|
71 @scope: public |
|
72 @variables: |
|
73 NW_WBXML_CP_Registry_Entry_t* storage |
|
74 Storage array. |
|
75 |
|
76 NW_WBXML_CP_Registry_Entry_t* current |
|
77 Current entry. |
|
78 |
|
79 NW_Int32 count |
|
80 Entry count. |
|
81 |
|
82 @description: The code page registry. |
|
83 ** ----------------------------------------------------------------------- **/ |
|
84 typedef struct NW_WBXML_CP_Registry_s { |
|
85 NW_WBXML_CP_Registry_Entry_t* storage; |
|
86 NW_WBXML_CP_Registry_Entry_t* current; |
|
87 NW_Int32 count; |
|
88 // WLIU_DEBUG:NW_Int32 realcount; |
|
89 } NW_WBXML_CP_Registry_t; |
|
90 |
|
91 /* ----------------------------------------------------------------------- ** |
|
92 TO DO: the NW_Byte code pointer needs to be removed and put into a |
|
93 derived class in the buffer implementation |
|
94 ** ----------------------------------------------------------------------- **/ |
|
95 |
|
96 /** ----------------------------------------------------------------------- ** |
|
97 @struct: NW_WBXML_Parser |
|
98 |
|
99 @synopsis: The parser. |
|
100 |
|
101 @scope: public |
|
102 @variables: |
|
103 const struct NW_WBXML_EventHandler_s* handler |
|
104 Event handlers. |
|
105 |
|
106 void* context |
|
107 Context to pass to event handlers. |
|
108 |
|
109 NW_Uint32 flags |
|
110 The flags. |
|
111 |
|
112 NW_Uint32 state |
|
113 The state. |
|
114 |
|
115 NW_Uint8 tag_code_page |
|
116 The tag code page. |
|
117 |
|
118 NW_Uint8 attribute_code_page |
|
119 The attribute code page. |
|
120 |
|
121 NW_WBXML_CP_Registry_t cp_registry |
|
122 The code page registry. |
|
123 |
|
124 NW_Uint32 dictionary |
|
125 1-based index into dictionary table. |
|
126 |
|
127 NW_WBXML_Document_t* doc |
|
128 The document. |
|
129 |
|
130 NW_Uint32 offset |
|
131 Offset into bytecode. |
|
132 |
|
133 NW_Uint32 left |
|
134 Byte code left after current pointer. |
|
135 |
|
136 NW_Status_t status |
|
137 Parser status from CallBacks. |
|
138 |
|
139 NW_Byte* p |
|
140 Byte code pointer. |
|
141 |
|
142 NW_Uint8 ext_t_not_table_index |
|
143 A boolean: whether the associated index with |
|
144 EXT_T_[0,1,2] refs a string table or not, defaults |
|
145 to 0 meaning use string table, 1 means associated |
|
146 integer with EXT_T_[0,1,2] is not a string table |
|
147 index |
|
148 |
|
149 @description: The parser. |
|
150 ** ----------------------------------------------------------------------- **/ |
|
151 struct NW_WBXML_Parser_s { |
|
152 const struct NW_WBXML_EventHandler_s* handler; /* Event handlers */ |
|
153 void* context; /* Context to pass to event handlers */ |
|
154 NW_Uint32 flags; |
|
155 NW_Uint32 state; |
|
156 NW_Uint8 tag_code_page; |
|
157 NW_Uint8 attribute_code_page; |
|
158 NW_WBXML_CP_Registry_t cp_registry; |
|
159 NW_Uint32 dictionary; /* 1-based index into dictionary table */ |
|
160 NW_WBXML_Document_t* doc; |
|
161 NW_Uint32 offset; /*Offset into bytecode */ |
|
162 NW_Uint32 left; /* Byte code left after current pointer */ |
|
163 NW_Status_t status; /* Parser status from CallBacks */ |
|
164 NW_Byte* p; /*Byte code pointer */ |
|
165 NW_Uint32 recursiveCallCnt; /* counts "element parse/content parse" recursive calls*/ |
|
166 /* a boolean, whether EXT_T_[0,1,2] refs a string table or not, |
|
167 defaults to 0 meaning use string table, 1 means associated |
|
168 integer with EXT_T_[0,1,2] is not a string table index */ |
|
169 NW_Uint8 ext_t_not_table_index; |
|
170 // WLIU_DEBUG: NW_Int32 lastValid; |
|
171 }; |
|
172 |
|
173 |
|
174 |
|
175 /** ----------------------------------------------------------------------- ** |
|
176 @function: NW_WBXML_Parser_newInPlace |
|
177 |
|
178 @synopsis: Parser initialization |
|
179 |
|
180 @scope: public |
|
181 |
|
182 @parameters: |
|
183 [in-out] NW_WBXML_Parser_t* parser |
|
184 The parser. |
|
185 |
|
186 @description: Parser initialization |
|
187 ** ----------------------------------------------------------------------- **/ |
|
188 IMPORT_C void |
|
189 NW_WBXML_Parser_newInPlace (NW_WBXML_Parser_t* parser); |
|
190 |
|
191 |
|
192 /** ----------------------------------------------------------------------- ** |
|
193 @function: NW_WBXML_Parser_reset |
|
194 |
|
195 @synopsis: Reset the parser. |
|
196 |
|
197 @scope: public |
|
198 |
|
199 @parameters: |
|
200 [in-out] NW_WBXML_Parser_t* parser |
|
201 The parser. |
|
202 |
|
203 @description: Reset the parser. |
|
204 |
|
205 ** ----------------------------------------------------------------------- **/ |
|
206 void |
|
207 NW_WBXML_Parser_reset (NW_WBXML_Parser_t* parser); |
|
208 |
|
209 |
|
210 /** ----------------------------------------------------------------------- ** |
|
211 @function: NW_WBXML_Parser_delete |
|
212 |
|
213 @synopsis: Destructor. |
|
214 |
|
215 @scope: public |
|
216 |
|
217 @parameters: |
|
218 [in-out] NW_WBXML_Parser_t* parser |
|
219 The parser. |
|
220 |
|
221 @description: Destructor. |
|
222 |
|
223 ** ----------------------------------------------------------------------- **/ |
|
224 void |
|
225 NW_WBXML_Parser_delete (NW_WBXML_Parser_t* parser); |
|
226 |
|
227 |
|
228 /** ----------------------------------------------------------------------- ** |
|
229 @function: NW_WBXML_Parser_addCPRegistry |
|
230 |
|
231 @synopsis: Add CP registry. |
|
232 |
|
233 @scope: public |
|
234 |
|
235 @parameters: |
|
236 [in-out] NW_WBXML_Parser_t* parser |
|
237 The parser. |
|
238 |
|
239 [in] NW_WBXML_CP_Registry_Entry_t* storage |
|
240 The entries. |
|
241 |
|
242 [in] NW_Int32 count |
|
243 The number of entries. |
|
244 |
|
245 @description: Create an uninitialized code page registry. As long |
|
246 as the registry is not created, it will be |
|
247 ignored. Once it has been created, the parser will |
|
248 check the REGISTRY_INIT flag. If this is not set, the |
|
249 registry will be initialized as the parser runs. If |
|
250 this is set, then the registry will be consulted when |
|
251 updating the offset. |
|
252 |
|
253 @returns: NW_Status_t |
|
254 Status of operation. |
|
255 |
|
256 [NW_STAT_SUCCESS] |
|
257 Always returns success. |
|
258 |
|
259 ** ----------------------------------------------------------------------- **/ |
|
260 NW_Status_t |
|
261 NW_WBXML_Parser_addCPRegistry(NW_WBXML_Parser_t* parser, |
|
262 NW_WBXML_CP_Registry_Entry_t* storage, |
|
263 NW_Int32 count); |
|
264 |
|
265 |
|
266 /** ----------------------------------------------------------------------- ** |
|
267 @function: NW_WBXML_Parser_registerHandler |
|
268 |
|
269 @synopsis: Register handler. |
|
270 |
|
271 @scope: public |
|
272 |
|
273 @parameters: |
|
274 [in] NW_WBXML_Parser_t* parser |
|
275 The parser. |
|
276 |
|
277 [in] const struct NW_WBXML_EventHandler_s* handler |
|
278 The handler. |
|
279 |
|
280 [in] void* context |
|
281 The context. |
|
282 |
|
283 @description: Cache the parser's event handler and context. |
|
284 |
|
285 @returns: NW_Status_t |
|
286 Status of operation. |
|
287 |
|
288 [NW_STAT_SUCCESS] |
|
289 Always returns success. |
|
290 |
|
291 ** ----------------------------------------------------------------------- **/ |
|
292 IMPORT_C NW_Status_t |
|
293 NW_WBXML_Parser_registerHandler(NW_WBXML_Parser_t* parser, |
|
294 const struct NW_WBXML_EventHandler_s* handler, |
|
295 void* context); |
|
296 |
|
297 |
|
298 /** ----------------------------------------------------------------------- ** |
|
299 @function: NW_WBXML_Parser_saveContext |
|
300 |
|
301 @synopsis: Save parser context. |
|
302 |
|
303 @scope: public |
|
304 |
|
305 @parameters: |
|
306 [in] NW_WBXML_Parser_t* parser |
|
307 The parser. |
|
308 |
|
309 [out] NW_WBXML_Parser_t* context |
|
310 The context. |
|
311 |
|
312 @description: Save/restore context can be used if the parser is to be |
|
313 invoked reentrantly (in a callback). Normally this should |
|
314 be avoided since the only really safe way to do this is to |
|
315 save the whole parser object on the stack. |
|
316 |
|
317 @returns: NW_Status_t |
|
318 Status of operation. |
|
319 |
|
320 [NW_STAT_SUCCESS] |
|
321 Always returns success. |
|
322 |
|
323 ** ----------------------------------------------------------------------- **/ |
|
324 NW_Status_t |
|
325 NW_WBXML_Parser_saveContext(NW_WBXML_Parser_t* parser, |
|
326 NW_WBXML_Parser_t* context); |
|
327 |
|
328 |
|
329 /** ----------------------------------------------------------------------- ** |
|
330 @function: NW_WBXML_Parser_restoreContext |
|
331 |
|
332 @synopsis: Restore parser context. |
|
333 |
|
334 @scope: public |
|
335 |
|
336 @parameters: |
|
337 [in] NW_WBXML_Parser_t* parser |
|
338 The parser. |
|
339 |
|
340 [in] NW_WBXML_Parser_t* context |
|
341 The context. |
|
342 |
|
343 @description: Restore parser context. See description for saveContext(). |
|
344 |
|
345 @returns: NW_Status_t |
|
346 Status of operation. |
|
347 |
|
348 [NW_STAT_SUCCESS] |
|
349 Always returns success. |
|
350 |
|
351 ** ----------------------------------------------------------------------- **/ |
|
352 NW_Status_t |
|
353 NW_WBXML_Parser_restoreContext(NW_WBXML_Parser_t* parser, |
|
354 NW_WBXML_Parser_t* context); |
|
355 |
|
356 /* ----------------------------------------------------------------------- ** |
|
357 Get and set methods |
|
358 ** ----------------------------------------------------------------------- **/ |
|
359 |
|
360 |
|
361 /** ----------------------------------------------------------------------- ** |
|
362 @function: NW_WBXML_Parser_getOffset |
|
363 |
|
364 @synopsis: Get offset. |
|
365 |
|
366 @scope: public |
|
367 |
|
368 @parameters: |
|
369 [in] NW_WBXML_Parser_t* parser |
|
370 The parser. |
|
371 |
|
372 @description: Get offset. |
|
373 |
|
374 @returns: NW_Uint32 |
|
375 Read offset. |
|
376 |
|
377 ** ----------------------------------------------------------------------- **/ |
|
378 NW_Uint32 |
|
379 NW_WBXML_Parser_getOffset(NW_WBXML_Parser_t* parser); |
|
380 |
|
381 |
|
382 /** ----------------------------------------------------------------------- ** |
|
383 @function: NW_WBXML_Parser_setOffset |
|
384 |
|
385 @synopsis: Set offset. |
|
386 |
|
387 @scope: public |
|
388 |
|
389 @parameters: |
|
390 [in-out] NW_WBXML_Parser_t* parser |
|
391 The parser. |
|
392 |
|
393 [in] NW_Uint32 offset |
|
394 New offset. |
|
395 |
|
396 @description: Set offset. |
|
397 |
|
398 @returns: NW_Int32 |
|
399 Offset or -1 if out of range. |
|
400 |
|
401 ** ----------------------------------------------------------------------- **/ |
|
402 NW_Int32 |
|
403 NW_WBXML_Parser_setOffset(NW_WBXML_Parser_t* parser, |
|
404 NW_Uint32 offset); |
|
405 |
|
406 |
|
407 /** ----------------------------------------------------------------------- ** |
|
408 @function: NW_WBXML_Parser_setTagCodepage |
|
409 |
|
410 @synopsis: Set tag codepage. |
|
411 |
|
412 @scope: public |
|
413 |
|
414 @parameters: |
|
415 [in-out] NW_WBXML_Parser_t* parser |
|
416 The parser. |
|
417 |
|
418 [in] NW_Uint8 page |
|
419 The page. |
|
420 |
|
421 @description: Set tag codepage. |
|
422 |
|
423 @returns: NW_Status_t |
|
424 Status of operation. |
|
425 |
|
426 [NW_STAT_SUCCESS] |
|
427 Always returns success. |
|
428 |
|
429 ** ----------------------------------------------------------------------- **/ |
|
430 NW_Status_t |
|
431 NW_WBXML_Parser_setTagCodepage(NW_WBXML_Parser_t* parser, |
|
432 NW_Uint8 page); |
|
433 |
|
434 |
|
435 /** ----------------------------------------------------------------------- ** |
|
436 @function: NW_WBXML_Parser_getTagCodepage |
|
437 |
|
438 @synopsis: Get tag codepage. |
|
439 |
|
440 @scope: public |
|
441 |
|
442 @parameters: |
|
443 [in] NW_WBXML_Parser_t* parser |
|
444 The parser. |
|
445 |
|
446 @description: Get tag codepage. |
|
447 |
|
448 @returns: NW_Uint8 |
|
449 The code page. |
|
450 |
|
451 ** ----------------------------------------------------------------------- **/ |
|
452 NW_Uint8 |
|
453 NW_WBXML_Parser_getTagCodepage(NW_WBXML_Parser_t* parser); |
|
454 |
|
455 |
|
456 /** ----------------------------------------------------------------------- ** |
|
457 @function: NW_WBXML_Parser_setAttrCodepage |
|
458 |
|
459 @synopsis: Set attribute codepage. |
|
460 |
|
461 @scope: public |
|
462 |
|
463 @parameters: |
|
464 [in-out] NW_WBXML_Parser_t* parser |
|
465 The parser. |
|
466 |
|
467 [in] NW_Uint8 page |
|
468 The code page. |
|
469 |
|
470 @description: Set attribute codepage. |
|
471 |
|
472 @returns: NW_Status_t |
|
473 Status of operation. |
|
474 |
|
475 [NW_STAT_SUCCESS] |
|
476 Always returns success. |
|
477 |
|
478 ** ----------------------------------------------------------------------- **/ |
|
479 NW_Status_t |
|
480 NW_WBXML_Parser_setAttrCodepage(NW_WBXML_Parser_t* parser, |
|
481 NW_Uint8 page); |
|
482 |
|
483 |
|
484 /** ----------------------------------------------------------------------- ** |
|
485 @function: NW_WBXML_Parser_getAttrCodepage |
|
486 |
|
487 @synopsis: Get attribute codepage. |
|
488 |
|
489 @scope: public |
|
490 |
|
491 @parameters: |
|
492 [in] NW_WBXML_Parser_t* parser |
|
493 The parser. |
|
494 |
|
495 @description: Get attribute codepage. |
|
496 |
|
497 @returns: NW_Uint8 |
|
498 Code page. |
|
499 |
|
500 ** ----------------------------------------------------------------------- **/ |
|
501 NW_Uint8 |
|
502 NW_WBXML_Parser_getAttrCodepage(NW_WBXML_Parser_t* parser); |
|
503 |
|
504 |
|
505 /* ----------------------------------------------------------------------- ** |
|
506 Parse document elements |
|
507 ** ----------------------------------------------------------------------- **/ |
|
508 |
|
509 |
|
510 /** ----------------------------------------------------------------------- ** |
|
511 @function: NW_WBXML_Parser_tagNameParse |
|
512 |
|
513 @synopsis: Tag name parse. |
|
514 |
|
515 @scope: public |
|
516 |
|
517 @parameters: |
|
518 [in-out] NW_WBXML_Parser_t* parser |
|
519 The parser. |
|
520 |
|
521 @description: Parse the token and name part of a tag. This generates a |
|
522 fully qualified token. |
|
523 |
|
524 @returns: NW_Status_t |
|
525 Status of operation. |
|
526 |
|
527 [NW_STAT_SUCCESS] |
|
528 Tag name parsed. |
|
529 |
|
530 [NW_STAT_WBXML_HAS_ATTRIBUTES] |
|
531 Has attributes. |
|
532 |
|
533 [NW_STAT_WBXML_HAS_ATTR_CONTENT] |
|
534 Has attribute content. |
|
535 |
|
536 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
537 Parse error. |
|
538 |
|
539 ** ----------------------------------------------------------------------- **/ |
|
540 NW_Status_t |
|
541 NW_WBXML_Parser_tagNameParse(NW_WBXML_Parser_t* parser); |
|
542 |
|
543 |
|
544 /** ----------------------------------------------------------------------- ** |
|
545 @function: NW_WBXML_Parser_attributeListIterate |
|
546 |
|
547 @synopsis: Parse an attribute list. |
|
548 @scope: public |
|
549 |
|
550 @parameters: |
|
551 [in-out] NW_WBXML_Parser_t* parser |
|
552 The parser. |
|
553 |
|
554 @description: Parse an attribute list |
|
555 |
|
556 @returns: NW_Status_t |
|
557 Status of operation. |
|
558 |
|
559 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
560 Parse error. |
|
561 |
|
562 [NW_STAT_WBXML_ITERATE_DONE] |
|
563 Done. |
|
564 |
|
565 [NW_STAT_WBXML_ITERATE_MORE] |
|
566 More to do. |
|
567 |
|
568 ** ----------------------------------------------------------------------- **/ |
|
569 NW_Status_t |
|
570 NW_WBXML_Parser_attributeListIterate (NW_WBXML_Parser_t* parser); |
|
571 |
|
572 |
|
573 /** ----------------------------------------------------------------------- ** |
|
574 @function: NW_WBXML_Parser_attributeValsIterate |
|
575 |
|
576 @synopsis: Parse an attribute value list. |
|
577 |
|
578 @scope: public |
|
579 |
|
580 @parameters: |
|
581 [in-out] NW_WBXML_Parser_t* parser |
|
582 The parser. |
|
583 |
|
584 @description: Parse an attribute value list. |
|
585 |
|
586 @returns: NW_Status_t |
|
587 Status of operation. |
|
588 |
|
589 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
590 Parse error. |
|
591 |
|
592 [NW_STAT_WBXML_ITERATE_DONE] |
|
593 Done. |
|
594 |
|
595 [NW_STAT_WBXML_ITERATE_MORE] |
|
596 More to do. |
|
597 |
|
598 ** ----------------------------------------------------------------------- **/ |
|
599 NW_Status_t |
|
600 NW_WBXML_Parser_attributeValsIterate (NW_WBXML_Parser_t* parser); |
|
601 |
|
602 |
|
603 /** ----------------------------------------------------------------------- ** |
|
604 @function: NW_WBXML_Parser_attributeNameParse |
|
605 |
|
606 @synopsis: Parse an attribute. |
|
607 |
|
608 @scope: public |
|
609 |
|
610 @parameters: |
|
611 [in-out] NW_WBXML_Parser_t* parser |
|
612 The parser. |
|
613 |
|
614 @description: Parse an attribute. |
|
615 |
|
616 @returns: NW_Status_t |
|
617 Status of operation. |
|
618 |
|
619 [NW_STAT_SUCCESS] |
|
620 Attribute parsed. |
|
621 |
|
622 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
623 Parse error. |
|
624 |
|
625 ** ----------------------------------------------------------------------- **/ |
|
626 NW_Status_t |
|
627 NW_WBXML_Parser_attributeNameParse (NW_WBXML_Parser_t* parser); |
|
628 |
|
629 |
|
630 /** ----------------------------------------------------------------------- ** |
|
631 @function: NW_WBXML_Parser_textIterate |
|
632 |
|
633 @synopsis: Parse text. |
|
634 |
|
635 @scope: public |
|
636 |
|
637 @parameters: |
|
638 [in-out] NW_WBXML_Parser_t* parser |
|
639 The parser. |
|
640 |
|
641 @description: Parse text. |
|
642 |
|
643 @returns: NW_Status_t |
|
644 Status of operation. |
|
645 |
|
646 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
647 Parse error. |
|
648 |
|
649 [NW_STAT_WBXML_ITERATE_DONE] |
|
650 Done. |
|
651 |
|
652 [NW_STAT_WBXML_ITERATE_MORE] |
|
653 More to do. |
|
654 |
|
655 ** ----------------------------------------------------------------------- **/ |
|
656 NW_Status_t |
|
657 NW_WBXML_Parser_textIterate(NW_WBXML_Parser_t* parser); |
|
658 |
|
659 |
|
660 /** ----------------------------------------------------------------------- ** |
|
661 @function: NW_WBXML_parser_attributeListIterate |
|
662 |
|
663 @synopsis: Parse an attribute list. |
|
664 @scope: public |
|
665 |
|
666 @parameters: |
|
667 [in-out] NW_WBXML_Parser_t* parser |
|
668 The parser. |
|
669 |
|
670 @description: Parse an attribute list. |
|
671 |
|
672 @returns: NW_Status_t |
|
673 Status of operation. |
|
674 |
|
675 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
676 Parse error. |
|
677 |
|
678 [NW_STAT_WBXML_ITERATE_DONE] |
|
679 Done. |
|
680 |
|
681 [NW_STAT_WBXML_ITERATE_MORE] |
|
682 More to do. |
|
683 |
|
684 ** ----------------------------------------------------------------------- **/ |
|
685 NW_Status_t |
|
686 NW_WBXML_parser_attributeListIterate(NW_WBXML_Parser_t* parser); |
|
687 |
|
688 |
|
689 /** ----------------------------------------------------------------------- ** |
|
690 @function: NW_WBXML_parser_attributeValsIterate |
|
691 |
|
692 @synopsis: Parse attribute values. |
|
693 |
|
694 @scope: public |
|
695 |
|
696 @parameters: |
|
697 [in-out] NW_WBXML_Parser_t* parser |
|
698 The parser. |
|
699 |
|
700 @description: Parse attribute values. |
|
701 |
|
702 @returns: NW_Status_t |
|
703 Status of operation. |
|
704 |
|
705 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
706 Parse error. |
|
707 |
|
708 [NW_STAT_WBXML_ITERATE_DONE] |
|
709 Done. |
|
710 |
|
711 [NW_STAT_WBXML_ITERATE_MORE] |
|
712 More to do. |
|
713 |
|
714 ** ----------------------------------------------------------------------- **/ |
|
715 NW_Status_t |
|
716 NW_WBXML_parser_attributeValsIterate (NW_WBXML_Parser_t* parser); |
|
717 |
|
718 |
|
719 /** ----------------------------------------------------------------------- ** |
|
720 @function: NW_WBXML_Parser_attributeParse |
|
721 |
|
722 @synopsis: Attribute parse. |
|
723 |
|
724 @scope: public |
|
725 |
|
726 @parameters: |
|
727 [in] NW_WBXML_Parser_t* parser |
|
728 The parser. |
|
729 |
|
730 @description: Attribute parse. |
|
731 |
|
732 @returns: NW_Status_t |
|
733 Status of operation. |
|
734 |
|
735 [NW_STAT_SUCCESS] |
|
736 Done. |
|
737 |
|
738 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
739 Parse error. |
|
740 |
|
741 ** ----------------------------------------------------------------------- **/ |
|
742 NW_Status_t |
|
743 NW_WBXML_Parser_attributeParse(NW_WBXML_Parser_t* parser); |
|
744 |
|
745 |
|
746 /** ----------------------------------------------------------------------- ** |
|
747 @function: NW_WBXML_Parser_contentParse |
|
748 |
|
749 @synopsis: Parse content. |
|
750 |
|
751 @scope: public |
|
752 |
|
753 @parameters: |
|
754 [in-out] NW_WBXML_Parser_t* parser |
|
755 The parser. |
|
756 |
|
757 @description: Parse content. |
|
758 |
|
759 @returns: NW_Status_t |
|
760 Status of operation. |
|
761 |
|
762 [NW_STAT_SUCCESS] |
|
763 Done. |
|
764 |
|
765 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
766 Parse error. |
|
767 |
|
768 ** ----------------------------------------------------------------------- **/ |
|
769 NW_Status_t |
|
770 NW_WBXML_Parser_contentParse (NW_WBXML_Parser_t* parser); |
|
771 |
|
772 |
|
773 /** ----------------------------------------------------------------------- ** |
|
774 @function: NW_WBXML_Parser_extensionParse |
|
775 |
|
776 @synopsis: Parse extension. |
|
777 |
|
778 @scope: public |
|
779 |
|
780 @parameters: |
|
781 [in-out] NW_WBXML_Parser_t* parser |
|
782 The parser. |
|
783 |
|
784 [in] NW_Int32 token_state |
|
785 Token state. |
|
786 |
|
787 @description: Parse extension. |
|
788 |
|
789 @returns: NW_Status_t |
|
790 Status of operation. |
|
791 |
|
792 [NW_STAT_SUCCESS] |
|
793 Done. |
|
794 |
|
795 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
796 Parse error. |
|
797 |
|
798 ** ----------------------------------------------------------------------- **/ |
|
799 NW_Status_t |
|
800 NW_WBXML_Parser_extensionParse (NW_WBXML_Parser_t* parser, |
|
801 NW_Int32 token_state); |
|
802 |
|
803 |
|
804 /** ----------------------------------------------------------------------- ** |
|
805 @function: NW_WBXML_Parser_opaqueParse |
|
806 |
|
807 @synopsis: Parse opaque data. |
|
808 |
|
809 @scope: public |
|
810 |
|
811 @parameters: |
|
812 [in-out] NW_WBXML_Parser_t* parser |
|
813 The parser. |
|
814 |
|
815 [in] NW_Int32 token_state |
|
816 Token state. |
|
817 |
|
818 @description: Parse opaque data. |
|
819 |
|
820 @returns: NW_Status_t |
|
821 Status of operation. |
|
822 |
|
823 [NW_STAT_SUCCESS] |
|
824 Done. |
|
825 |
|
826 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
827 Parse error. |
|
828 |
|
829 ** ----------------------------------------------------------------------- **/ |
|
830 NW_Status_t |
|
831 NW_WBXML_Parser_opaqueParse (NW_WBXML_Parser_t* parser, |
|
832 NW_Int32 token_state); |
|
833 |
|
834 /* ----------------------------------------------------------------------- ** |
|
835 TODO READ_WRITE only? |
|
836 ** ----------------------------------------------------------------------- **/ |
|
837 |
|
838 |
|
839 /** ----------------------------------------------------------------------- ** |
|
840 @function: NW_WBXML_Parser_setBuffer |
|
841 |
|
842 @synopsis: Sets parser to use a buffer without parsing it. |
|
843 |
|
844 @scope: public |
|
845 |
|
846 @parameters: |
|
847 [in-out] NW_WBXML_Parser_t* parser |
|
848 The parser. |
|
849 |
|
850 [in] NW_WBXML_Document_t* doc |
|
851 The document. |
|
852 |
|
853 [in] NW_Byte* buf |
|
854 The buffer. |
|
855 |
|
856 [in] NW_Uint32 bufsize |
|
857 The size of the buffer. |
|
858 |
|
859 @description: This method sets the parser to use a buffer without |
|
860 actually parsing it. This is used by clients who want |
|
861 to create a tree from scratch without parsing a |
|
862 document. This requires that doc be initialized with |
|
863 any document type and charset and that the parser be |
|
864 initialized. This should leave the parser in the same |
|
865 state as NW_WBXML_Parser_parserBuffer() followed by |
|
866 NW_WBXML_Parser_reintialize(). |
|
867 |
|
868 @returns: NW_Status_t |
|
869 Status of operation. |
|
870 |
|
871 [NW_STAT_SUCCESS] |
|
872 Always returns success. |
|
873 |
|
874 ** ----------------------------------------------------------------------- **/ |
|
875 NW_Status_t |
|
876 NW_WBXML_Parser_setBuffer (NW_WBXML_Parser_t* parser, |
|
877 NW_WBXML_Document_t* doc, |
|
878 NW_Byte* buf, |
|
879 NW_Uint32 bufsize); |
|
880 |
|
881 |
|
882 /** ----------------------------------------------------------------------- ** |
|
883 @function: NW_WBXML_Parser_resetBuffer |
|
884 |
|
885 @synopsis: Reset buffer. |
|
886 |
|
887 @scope: public |
|
888 |
|
889 @parameters: |
|
890 [in-out] NW_WBXML_Parser_t* parser |
|
891 The parser. |
|
892 |
|
893 [in] NW_Byte* buff |
|
894 The buffer. |
|
895 |
|
896 [in] NW_Uint32 buffsize |
|
897 The size of the buffer. |
|
898 |
|
899 @description: Reset the parser buffer without resetting the doc. |
|
900 This is more efficient when, for example, the buffer |
|
901 gets resized due to a reallocation. |
|
902 |
|
903 @returns: NW_Status_t |
|
904 Status of operation. |
|
905 |
|
906 [NW_STAT_SUCCESS] |
|
907 Always returns success. |
|
908 |
|
909 ** ----------------------------------------------------------------------- **/ |
|
910 NW_Status_t |
|
911 NW_WBXML_Parser_resetBuffer(NW_WBXML_Parser_t* parser, |
|
912 NW_Byte* buff, |
|
913 NW_Uint32 buffsize); |
|
914 |
|
915 /* ----------------------------------------------------------------------- ** |
|
916 TODO: Move to parser buffer header? |
|
917 ** ----------------------------------------------------------------------- **/ |
|
918 |
|
919 |
|
920 /** ----------------------------------------------------------------------- ** |
|
921 @function: NW_WBXML_Parser_parseBuffer |
|
922 |
|
923 @synopsis: Parse buffer. |
|
924 |
|
925 @scope: public |
|
926 |
|
927 @parameters: |
|
928 [in-out] NW_WBXML_Parser_t* parser |
|
929 The parser. |
|
930 |
|
931 [in] NW_WBXML_Document_t* doc |
|
932 The document. |
|
933 |
|
934 [in] NW_Byte* buf |
|
935 The buffer. |
|
936 |
|
937 [in] NW_Uint32 bufsize |
|
938 The size of the buffer. |
|
939 |
|
940 @description: Parse document from a buffer. |
|
941 |
|
942 @returns: NW_Status_t |
|
943 Status of the operation. |
|
944 |
|
945 [NW_STAT_SUCCESS] |
|
946 Done. |
|
947 |
|
948 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
949 Parse error. |
|
950 |
|
951 [NW_STAT_OUT_OF_MEMORY] |
|
952 Out of memory. |
|
953 |
|
954 [NW_STAT_BAD_INPUT_PARAM] |
|
955 Requird parameter is NULL. |
|
956 |
|
957 [NW_STAT_WBXML_ERROR_CHARSET_UNSUPPORTED] |
|
958 Invalid character set. |
|
959 |
|
960 ** ----------------------------------------------------------------------- **/ |
|
961 IMPORT_C NW_Status_t |
|
962 NW_WBXML_Parser_parseBuffer (NW_WBXML_Parser_t* parser, |
|
963 NW_WBXML_Document_t* doc, |
|
964 NW_Byte* buf, |
|
965 NW_Uint32 bufsize); |
|
966 |
|
967 #ifdef __cplusplus |
|
968 } /* extern "C" { */ |
|
969 #endif /* __cplusplus */ |
|
970 |
|
971 #endif /* NW_PARSER_WBXML_PARSE_H */ |