24
|
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_TinyDom
|
|
21 |
|
|
22 |
@synopsis: default
|
|
23 |
|
|
24 |
@description: default
|
|
25 |
|
|
26 |
** ----------------------------------------------------------------------- **/
|
|
27 |
|
|
28 |
#ifndef NW_TINY_DOM_H
|
|
29 |
#define NW_TINY_DOM_H
|
|
30 |
|
|
31 |
#include <xml/cxml/cxml_proj.h>
|
|
32 |
#include <xml/cxml/nw_tinytree.h>
|
|
33 |
#include <xml/cxml/nw_wbxml_document.h>
|
|
34 |
#include <xml/cxml/nw_wbxml_parse.h>
|
|
35 |
#include <xml/cxml/nw_wbxml_opaque.h>
|
|
36 |
#include <xml/cxml/nw_encoder_wbxmlwriter.h>
|
|
37 |
|
|
38 |
#ifdef __cplusplus
|
|
39 |
extern "C" {
|
|
40 |
#endif /* __cplusplus */
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
enum NW_TinyDom_ExtensionType_e {
|
|
46 |
NW_TINYDOM_EXTENSION_TYPE_NORMAL,
|
|
47 |
NW_TINYDOM_EXTENSION_TYPE_EXT_T_INTEGER
|
|
48 |
};
|
|
49 |
|
|
50 |
|
|
51 |
/** ----------------------------------------------------------------------- **
|
|
52 |
@struct: NW_TinyDom_Extension
|
|
53 |
|
|
54 |
@synopsis: Extension structure.
|
|
55 |
|
|
56 |
@scope: public
|
|
57 |
@variables:
|
|
58 |
NW_Uint32 token
|
|
59 |
Token.
|
|
60 |
|
|
61 |
NW_String_t string
|
|
62 |
Extension string.
|
|
63 |
|
|
64 |
@description: Extension structure.
|
|
65 |
** ----------------------------------------------------------------------- **/
|
|
66 |
typedef struct NW_TinyDom_Extension_s{
|
|
67 |
/* type is either NW_TINYDOM_EXTENSION_TYPE_NORMAL or
|
|
68 |
NW_TINYDOM_EXTENSION_TYPE_EXT_T_INTEGER */
|
|
69 |
NW_Uint8 type;
|
|
70 |
NW_Uint32 token;
|
|
71 |
union {
|
|
72 |
NW_String_t string;
|
|
73 |
NW_Uint32 x;
|
|
74 |
} value;
|
|
75 |
} NW_TinyDom_Extension_t;
|
|
76 |
|
|
77 |
|
|
78 |
/** ----------------------------------------------------------------------- **
|
|
79 |
@union: NW_TinyDom_AttrValComponent
|
|
80 |
|
|
81 |
@synopsis: Attribute value component union.
|
|
82 |
|
|
83 |
@scope: public
|
|
84 |
@variables:
|
|
85 |
NW_Uint32 value_token
|
|
86 |
token
|
|
87 |
|
|
88 |
NW_String_t string
|
|
89 |
string
|
|
90 |
|
|
91 |
NW_TinyDom_Extension_t ext
|
|
92 |
extension
|
|
93 |
|
|
94 |
NW_Uint32 entity
|
|
95 |
entity.
|
|
96 |
|
|
97 |
NW_WBXML_Opaque_t opaque
|
|
98 |
opaque
|
|
99 |
|
|
100 |
@description: Union of all possible attribute value types.
|
|
101 |
** ----------------------------------------------------------------------- **/
|
|
102 |
typedef union NW_TinyDom_AttrValComponent_u{
|
|
103 |
NW_Uint32 value_token;
|
|
104 |
NW_String_t string;
|
|
105 |
NW_TinyDom_Extension_t ext;
|
|
106 |
NW_Uint32 entity;
|
|
107 |
NW_WBXML_Opaque_t opaque;
|
|
108 |
}NW_TinyDom_AttrValComponent_t;
|
|
109 |
|
|
110 |
|
|
111 |
/** ----------------------------------------------------------------------- **
|
|
112 |
@struct: NW_TinyDom_AttrVal
|
|
113 |
|
|
114 |
@synopsis: Attribute value.
|
|
115 |
|
|
116 |
@scope: public
|
|
117 |
@variables:
|
|
118 |
NW_Uint32 type
|
|
119 |
type
|
|
120 |
|
|
121 |
NW_TinyDom_AttrValComponent_t component
|
|
122 |
attribute value union of all possible types.
|
|
123 |
|
|
124 |
@description: An attribute value has a type info field and a union of
|
|
125 |
all the possible types. The type info values are defined
|
|
126 |
in NW_WBXML_Attribute.h. This type is designed to be
|
|
127 |
passed as an in/out param to the attribute value iterator.
|
|
128 |
** ----------------------------------------------------------------------- **/
|
|
129 |
typedef struct NW_TinyDom_AttrVal_s {
|
|
130 |
NW_Uint32 type;
|
|
131 |
NW_TinyDom_AttrValComponent_t component;
|
|
132 |
} NW_TinyDom_AttrVal_t;
|
|
133 |
|
|
134 |
|
|
135 |
/* Node type bits */
|
|
136 |
|
|
137 |
#define T_DOM_NODE_DOC (NW_Uint16)00
|
|
138 |
#define T_DOM_NODE_TAG (NW_Uint16)01
|
|
139 |
#define T_DOM_NODE_ATTR (NW_Uint16)02
|
|
140 |
#define T_DOM_NODE_TEXT (NW_Uint16)03
|
|
141 |
#define T_DOM_NODE_PI (NW_Uint16)04
|
|
142 |
#define T_DOM_NODE_COMMENT (NW_Uint16)05
|
|
143 |
#define T_DOM_NODE_CDATASECTION (NW_Uint16)06
|
|
144 |
#define T_DOM_NODE_XML (NW_Uint16)80
|
|
145 |
|
|
146 |
|
|
147 |
/** ----------------------------------------------------------------------- **
|
|
148 |
@struct: NW_TinyDom_Tree
|
|
149 |
|
|
150 |
@synopsis: Wrapper for tree components.
|
|
151 |
|
|
152 |
@scope: public
|
|
153 |
@variables:
|
|
154 |
NW_WBXML_Document_t* doc
|
|
155 |
The document.
|
|
156 |
|
|
157 |
NW_TinyTree_t tree
|
|
158 |
The tree.
|
|
159 |
|
|
160 |
NW_WBXML_Parser_t* parser
|
|
161 |
Parser associated with this tree.
|
|
162 |
|
|
163 |
NW_WBXML_Writer_t* writer
|
|
164 |
Writer for this tree.
|
|
165 |
|
|
166 |
NW_TinyTree_Node_t* root_node
|
|
167 |
Root node of tree.
|
|
168 |
|
|
169 |
@description: Wrapper for tree components.
|
|
170 |
** ----------------------------------------------------------------------- **/
|
|
171 |
typedef struct NW_TinyDom_Tree_s{
|
|
172 |
NW_WBXML_Document_t* doc;
|
|
173 |
NW_TinyTree_t tree;
|
|
174 |
NW_WBXML_Parser_t* parser;
|
|
175 |
NW_WBXML_Writer_t* writer;
|
|
176 |
NW_TinyTree_Node_t* root_node;
|
|
177 |
}NW_TinyDom_Tree_t;
|
|
178 |
|
|
179 |
|
|
180 |
/** ----------------------------------------------------------------------- **
|
|
181 |
@struct: NW_TinyDom_Parser
|
|
182 |
|
|
183 |
@synopsis: Parser structure.
|
|
184 |
|
|
185 |
@scope: public
|
|
186 |
@variables:
|
|
187 |
NW_Uint32 state
|
|
188 |
State.
|
|
189 |
|
|
190 |
NW_TinyTree_Offset_t node_count
|
|
191 |
default
|
|
192 |
|
|
193 |
NW_TinyTree_Offset_t cp_count
|
|
194 |
Current offset.
|
|
195 |
|
|
196 |
NW_TinyDom_Tree_t* dom_tree
|
|
197 |
The tree.
|
|
198 |
|
|
199 |
NW_TinyTree_Node_t* current_node
|
|
200 |
Present position in tree.
|
|
201 |
|
|
202 |
NW_TinyTree_Offset_t content_offset
|
|
203 |
Present offset into buffer.
|
|
204 |
|
|
205 |
@description: Parser structure.
|
|
206 |
** ----------------------------------------------------------------------- **/
|
|
207 |
typedef struct NW_TinyDom_Parser_s{
|
|
208 |
NW_Uint32 state;
|
|
209 |
NW_TinyTree_Offset_t node_count;
|
|
210 |
NW_TinyTree_Offset_t cp_count;
|
|
211 |
NW_TinyDom_Tree_t* dom_tree;
|
|
212 |
NW_TinyTree_Node_t* current_node;
|
|
213 |
/* Offset where current content begins */
|
|
214 |
NW_TinyTree_Offset_t content_offset;
|
|
215 |
}NW_TinyDom_Parser_t;
|
|
216 |
|
|
217 |
|
|
218 |
/** ----------------------------------------------------------------------- **
|
|
219 |
@function: NW_TinyDom_Tree_construct
|
|
220 |
|
|
221 |
@synopsis: Constructor.
|
|
222 |
|
|
223 |
@scope: public
|
|
224 |
|
|
225 |
@parameters:
|
|
226 |
[in-out] NW_TinyDom_Tree_t* domTree
|
|
227 |
The tree.
|
|
228 |
|
|
229 |
[in] NW_WBXML_Parser_t* wbxmlParser
|
|
230 |
The parser
|
|
231 |
|
|
232 |
[in] NW_WBXML_Document_t* doc
|
|
233 |
The document.
|
|
234 |
|
|
235 |
[in] NW_WBXML_Writer_t* writer
|
|
236 |
The writer.
|
|
237 |
|
|
238 |
@description: Constructor.
|
|
239 |
|
|
240 |
** ----------------------------------------------------------------------- **/
|
|
241 |
void
|
|
242 |
NW_TinyDom_Tree_construct(NW_TinyDom_Tree_t* domTree,
|
|
243 |
NW_WBXML_Parser_t* wbxmlParser,
|
|
244 |
NW_WBXML_Document_t* doc,
|
|
245 |
NW_WBXML_Writer_t* writer);
|
|
246 |
|
|
247 |
|
|
248 |
/** ----------------------------------------------------------------------- **
|
|
249 |
@function: NW_TinyDom_Tree_destruct
|
|
250 |
|
|
251 |
@synopsis: Destructor.
|
|
252 |
|
|
253 |
@scope: public
|
|
254 |
|
|
255 |
@parameters:
|
|
256 |
[in-out] NW_TinyDom_Tree_t* domTree
|
|
257 |
The DOM tree.
|
|
258 |
|
|
259 |
@description: Destructor.
|
|
260 |
|
|
261 |
** ----------------------------------------------------------------------- **/
|
|
262 |
void
|
|
263 |
NW_TinyDom_Tree_destruct(NW_TinyDom_Tree_t* domTree);
|
|
264 |
|
|
265 |
|
|
266 |
/** ----------------------------------------------------------------------- **
|
|
267 |
@function: NW_TinyDom_Parser_construct
|
|
268 |
|
|
269 |
@synopsis: Constructor.
|
|
270 |
|
|
271 |
@scope: public
|
|
272 |
|
|
273 |
@parameters:
|
|
274 |
[in] NW_TinyDom_Parser_t* domParser
|
|
275 |
The DOM parser.
|
|
276 |
|
|
277 |
[in] NW_TinyDom_Tree_t* domTree
|
|
278 |
The DOM tree.
|
|
279 |
|
|
280 |
@description: Constructor.
|
|
281 |
|
|
282 |
** ----------------------------------------------------------------------- **/
|
|
283 |
IMPORT_C void
|
|
284 |
NW_TinyDom_Parser_construct(NW_TinyDom_Parser_t* domParser,
|
|
285 |
NW_TinyDom_Tree_t* domTree);
|
|
286 |
|
|
287 |
|
|
288 |
/** ----------------------------------------------------------------------- **
|
|
289 |
@function: NW_TinyDom_Parser_destruct
|
|
290 |
|
|
291 |
@synopsis: Desctructor.
|
|
292 |
|
|
293 |
@scope: public
|
|
294 |
|
|
295 |
@parameters:
|
|
296 |
[in-out] NW_TinyDom_Parser_t* domParser
|
|
297 |
The DOM parser.
|
|
298 |
|
|
299 |
@description: Destructor.
|
|
300 |
|
|
301 |
** ----------------------------------------------------------------------- **/
|
|
302 |
void
|
|
303 |
NW_TinyDom_Parser_destruct(NW_TinyDom_Parser_t* domParser);
|
|
304 |
|
|
305 |
|
|
306 |
/** ----------------------------------------------------------------------- **
|
|
307 |
@function: NW_TinyDom_Parser_buildTree
|
|
308 |
|
|
309 |
@synopsis: Build tiny DOM tree.
|
|
310 |
|
|
311 |
@scope: public
|
|
312 |
|
|
313 |
@parameters:
|
|
314 |
[in] NW_TinyDom_Parser_t* domParser
|
|
315 |
The DOM parser.
|
|
316 |
|
|
317 |
[in] char* buffer
|
|
318 |
The buffer containing the document data.
|
|
319 |
|
|
320 |
[in] NW_Uint32 buffsize
|
|
321 |
The size of the document buffer.
|
|
322 |
|
|
323 |
[in] NW_Bool freeBuff
|
|
324 |
Flag
|
|
325 |
|
|
326 |
@description: Builds a DOM tree. The DOM parser must previously have
|
|
327 |
been initialized to use a parser (WBXML or XML) that
|
|
328 |
knows how to parse the contents of the buffer.Build tiny
|
|
329 |
DOM tree. Run Pass1 and Pass 2.
|
|
330 |
|
|
331 |
@returns: NW_Status_t
|
|
332 |
default
|
|
333 |
|
|
334 |
[NW_STAT_SUCCESS]
|
|
335 |
Tree built.
|
|
336 |
|
|
337 |
[NW_STAT_WBXML_ERROR_BYTECODE]
|
|
338 |
General error.
|
|
339 |
|
|
340 |
[NW_STAT_OUT_OF_MEMORY]
|
|
341 |
Out of memory.
|
|
342 |
|
|
343 |
** ----------------------------------------------------------------------- **/
|
|
344 |
NW_Status_t
|
|
345 |
NW_TinyDom_Parser_buildTree(NW_TinyDom_Parser_t* domParser,
|
|
346 |
char* buffer,
|
|
347 |
NW_Uint32 buffsize,
|
|
348 |
NW_Bool freeBuff);
|
|
349 |
|
|
350 |
/** ----------------------------------------------------------------------- **
|
|
351 |
@function: NW_TinyDom_Parser_incrementalBuildTree
|
|
352 |
|
|
353 |
@synopsis: build/append tiny DOM tree.
|
|
354 |
|
|
355 |
@scope: public
|
|
356 |
|
|
357 |
@parameters:
|
|
358 |
[in] NW_TinyDom_Parser_t* domParser
|
|
359 |
The DOM parser.
|
|
360 |
|
|
361 |
[in] char* buffer
|
|
362 |
The buffer containing the document data.
|
|
363 |
|
|
364 |
[in] NW_Uint32 buffsize
|
|
365 |
The size of the document buffer.
|
|
366 |
|
|
367 |
[in] NW_Bool freeBuff
|
|
368 |
Flag
|
|
369 |
|
|
370 |
@description: Builds a DOM tree. The DOM parser must previously have
|
|
371 |
been initialized to use a parser (WBXML or XML) that
|
|
372 |
knows how to parse the contents of the buffer.Build tiny
|
|
373 |
DOM tree. Run Pass1 and Pass 2.
|
|
374 |
|
|
375 |
@returns: NW_Status_t
|
|
376 |
default
|
|
377 |
|
|
378 |
[NW_STAT_SUCCESS]
|
|
379 |
Tree built.
|
|
380 |
|
|
381 |
[NW_STAT_WBXML_ERROR_BYTECODE]
|
|
382 |
General error.
|
|
383 |
|
|
384 |
[NW_STAT_OUT_OF_MEMORY]
|
|
385 |
Out of memory.
|
|
386 |
|
|
387 |
** ----------------------------------------------------------------------- **/
|
|
388 |
NW_Status_t
|
|
389 |
NW_TinyDom_Parser_incrementalBuildTree(NW_TinyDom_Parser_t* domParser,
|
|
390 |
char* buffer,
|
|
391 |
NW_Uint32 buffsize,
|
|
392 |
NW_Bool freeBuff,
|
|
393 |
NW_Int32 lastValid);
|
|
394 |
|
|
395 |
/** ----------------------------------------------------------------------- **
|
|
396 |
@function: NW_TinyDom_Node_getType
|
|
397 |
|
|
398 |
@synopsis: Get node type.
|
|
399 |
|
|
400 |
@scope: public
|
|
401 |
|
|
402 |
@parameters:
|
|
403 |
[in] NW_TinyTree_Node_t* node
|
|
404 |
The DOM parser.
|
|
405 |
|
|
406 |
@description: Get node type.
|
|
407 |
|
|
408 |
@returns: NW_Uint16
|
|
409 |
Node flag.
|
|
410 |
|
|
411 |
** ----------------------------------------------------------------------- **/
|
|
412 |
NW_Uint16
|
|
413 |
NW_TinyDom_Node_getType(NW_TinyTree_Node_t* node);
|
|
414 |
|
|
415 |
|
|
416 |
/** ----------------------------------------------------------------------- **
|
|
417 |
@struct: NW_TinyDom_ListIterator
|
|
418 |
|
|
419 |
@synopsis: ListIterator structure.
|
|
420 |
|
|
421 |
@scope: public
|
|
422 |
@variables:
|
|
423 |
NW_Uint32 state
|
|
424 |
Iterator state.
|
|
425 |
|
|
426 |
void* segment
|
|
427 |
Segment
|
|
428 |
|
|
429 |
NW_TinyTree_Offset_t segSize
|
|
430 |
Segment size
|
|
431 |
|
|
432 |
NW_TinyTree_Offset_t offset
|
|
433 |
Offset into document.
|
|
434 |
|
|
435 |
NW_TinyDom_Parser_t* tiny_parser
|
|
436 |
Parser used for iteration.
|
|
437 |
|
|
438 |
void* context
|
|
439 |
Context.
|
|
440 |
|
|
441 |
@description: ListIterator structure.
|
|
442 |
** ----------------------------------------------------------------------- **/
|
|
443 |
typedef struct NW_TinyDom_ListIterator_s {
|
|
444 |
NW_Uint32 state;
|
|
445 |
void* segment;
|
|
446 |
NW_TinyTree_Offset_t segSize;
|
|
447 |
NW_TinyTree_Offset_t offset;
|
|
448 |
NW_TinyDom_Parser_t* tiny_parser;
|
|
449 |
void* context;
|
|
450 |
}NW_TinyDom_ListIterator_t;
|
|
451 |
|
|
452 |
|
|
453 |
/* Tiny dom routines to support tags */
|
|
454 |
|
|
455 |
|
|
456 |
/** ----------------------------------------------------------------------- **
|
|
457 |
@struct: NW_TinyDom_Tag
|
|
458 |
|
|
459 |
@synopsis: Tag structure.
|
|
460 |
|
|
461 |
@scope: public
|
|
462 |
@variables:
|
|
463 |
NW_TinyDom_Parser_t* tiny_parser
|
|
464 |
This parser.
|
|
465 |
|
|
466 |
NW_Uint32 fq_token
|
|
467 |
Token with codepage and attribute/element tag.
|
|
468 |
|
|
469 |
NW_Uint32 name_index
|
|
470 |
Index of first character of name into string table.
|
|
471 |
|
|
472 |
@description: Tag structure.
|
|
473 |
** ----------------------------------------------------------------------- **/
|
|
474 |
typedef struct NW_TinyDom_Tag_s {
|
|
475 |
NW_TinyDom_Parser_t* tiny_parser;
|
|
476 |
NW_Uint32 fq_token;
|
|
477 |
NW_Uint32 name_index;
|
|
478 |
}NW_TinyDom_Tag_t;
|
|
479 |
|
|
480 |
|
|
481 |
/** ----------------------------------------------------------------------- **
|
|
482 |
@function: NW_TinyDom_getTagToken
|
|
483 |
|
|
484 |
@synopsis: Get tag token.
|
|
485 |
|
|
486 |
@scope: public
|
|
487 |
|
|
488 |
@parameters:
|
|
489 |
[in] NW_TinyDom_Parser_t* parser
|
|
490 |
The parser.
|
|
491 |
|
|
492 |
[in] NW_TinyTree_Node_t* node
|
|
493 |
Node to use.
|
|
494 |
|
|
495 |
@description: Get tag token.
|
|
496 |
|
|
497 |
@returns: NW_Uint32
|
|
498 |
Tag token.
|
|
499 |
|
|
500 |
** ----------------------------------------------------------------------- **/
|
|
501 |
IMPORT_C NW_Uint32
|
|
502 |
NW_TinyDom_getTagToken(NW_TinyDom_Parser_t* parser,
|
|
503 |
NW_TinyTree_Node_t* node);
|
|
504 |
|
|
505 |
|
|
506 |
/** ----------------------------------------------------------------------- **
|
|
507 |
@function: NW_TinyDom_getTagName
|
|
508 |
|
|
509 |
@synopsis: Get tag name.
|
|
510 |
|
|
511 |
@scope: public
|
|
512 |
|
|
513 |
@parameters:
|
|
514 |
[in] NW_TinyDom_Parser_t* parser
|
|
515 |
This parser.
|
|
516 |
|
|
517 |
[in] NW_TinyTree_Node_t* node
|
|
518 |
This node.
|
|
519 |
|
|
520 |
[out] NW_String_t* name
|
|
521 |
Name of tag.
|
|
522 |
|
|
523 |
@description: Get tag name.
|
|
524 |
|
|
525 |
@returns: NW_Status_t
|
|
526 |
Status of operation.
|
|
527 |
|
|
528 |
[NW_STAT_SUCCESS]
|
|
529 |
Name found.
|
|
530 |
|
|
531 |
[NW_STAT_WBXML_NO_NAME]
|
|
532 |
No name found.
|
|
533 |
|
|
534 |
[NW_STAT_WBXML_ERROR_BYTECODE]
|
|
535 |
No name found.
|
|
536 |
|
|
537 |
** ----------------------------------------------------------------------- **/
|
|
538 |
NW_Status_t
|
|
539 |
NW_TinyDom_getTagName(NW_TinyDom_Parser_t* parser,
|
|
540 |
NW_TinyTree_Node_t* node,
|
|
541 |
NW_String_t* name);
|
|
542 |
|
|
543 |
/* Tiny dom routines to support attributes */
|
|
544 |
|
|
545 |
/** ----------------------------------------------------------------------- **
|
|
546 |
@typedef: NW_TinyDom_AttrListHandle
|
|
547 |
|
|
548 |
@synopsis: Attribute list handle.
|
|
549 |
|
|
550 |
@scope: public
|
|
551 |
@type: NW_TinyDom_ListIterator_t
|
|
552 |
|
|
553 |
@description: Attribute list handle.
|
|
554 |
** ----------------------------------------------------------------------- **/
|
|
555 |
typedef NW_TinyDom_ListIterator_t NW_TinyDom_AttrListHandle_t;
|
|
556 |
|
|
557 |
|
|
558 |
/** ----------------------------------------------------------------------- **
|
|
559 |
@function: NW_TinyDom_AttrListHandle_init
|
|
560 |
|
|
561 |
@synopsis: Initialize attribute list handle.
|
|
562 |
|
|
563 |
@scope: public
|
|
564 |
|
|
565 |
@parameters:
|
|
566 |
[in] NW_TinyDom_AttrListHandle_t* handle
|
|
567 |
This handle.
|
|
568 |
|
|
569 |
[in] NW_TinyDom_Parser_t* parser
|
|
570 |
This parser.
|
|
571 |
|
|
572 |
[in] NW_TinyTree_Node_t* node
|
|
573 |
This node.
|
|
574 |
|
|
575 |
@description: Initialize attribute list handle.
|
|
576 |
|
|
577 |
** ----------------------------------------------------------------------- **/
|
|
578 |
void
|
|
579 |
NW_TinyDom_AttrListHandle_init(NW_TinyDom_AttrListHandle_t* handle,
|
|
580 |
NW_TinyDom_Parser_t* parser,
|
|
581 |
NW_TinyTree_Node_t* node);
|
|
582 |
|
|
583 |
|
|
584 |
/** ----------------------------------------------------------------------- **
|
|
585 |
@function: NW_TinyDom_AttrListHandle_iterate
|
|
586 |
|
|
587 |
@synopsis: Iterate through a list of attributes.
|
|
588 |
|
|
589 |
@scope: public
|
|
590 |
|
|
591 |
@parameters:
|
|
592 |
[in-out] NW_TinyDom_AttrListHandle_t* handle
|
|
593 |
The handle.
|
|
594 |
|
|
595 |
@description: Iterate through a list of attributes. There are no
|
|
596 |
attribute list callbacks since we just want to iterate
|
|
597 |
the attribute list, returning the start of each attribute.
|
|
598 |
|
|
599 |
@returns: NW_TinyTree_Offset_t
|
|
600 |
Tree offset or NULL if at end of iteration.
|
|
601 |
|
|
602 |
** ----------------------------------------------------------------------- **/
|
|
603 |
NW_TinyTree_Offset_t
|
|
604 |
NW_TinyDom_AttrListHandle_iterate(NW_TinyDom_AttrListHandle_t* handle);
|
|
605 |
|
|
606 |
|
|
607 |
/** ----------------------------------------------------------------------- **
|
|
608 |
@struct: NW_TinyDom_AttributeHandle
|
|
609 |
|
|
610 |
@synopsis: An attribute handle, for iteration over values.
|
|
611 |
|
|
612 |
@scope: public
|
|
613 |
@variables:
|
|
614 |
NW_TinyDom_ListIterator_t tlit
|
|
615 |
The iterator structure.
|
|
616 |
|
|
617 |
void* value
|
|
618 |
The current value.
|
|
619 |
|
|
620 |
NW_Uint32 fq_token
|
|
621 |
Fully qualified token. That is: token, codepage and
|
|
622 |
attribute flag.
|
|
623 |
|
|
624 |
NW_Uint32 name_index
|
|
625 |
Index into string table.
|
|
626 |
|
|
627 |
@description: An attribute handle, for iteration over values.
|
|
628 |
** ----------------------------------------------------------------------- **/
|
|
629 |
typedef struct NW_TinyDom_AttributeHandle_s {
|
|
630 |
NW_TinyDom_ListIterator_t tlit;
|
|
631 |
/* field value is a pointer to the struct to fill in by parsing */
|
|
632 |
NW_TinyDom_AttrVal_t* value;
|
|
633 |
NW_Uint32 fq_token;
|
|
634 |
NW_Uint32 name_index;
|
|
635 |
} NW_TinyDom_AttributeHandle_t;
|
|
636 |
|
|
637 |
|
|
638 |
/* ----------------------------------------------------------------------- **
|
|
639 |
Attribute values are made up of components of several types. These are
|
|
640 |
defined in WBXML/types.h
|
|
641 |
** ----------------------------------------------------------------------- **/
|
|
642 |
|
|
643 |
/** ----------------------------------------------------------------------- **
|
|
644 |
@function: NW_TinyDom_AttributeHandle_init
|
|
645 |
|
|
646 |
@synopsis: Initialize an attribute handle.
|
|
647 |
|
|
648 |
@scope: public
|
|
649 |
|
|
650 |
@parameters:
|
|
651 |
[in-out] NW_TinyDom_AttributeHandle_t* handle
|
|
652 |
The handle.
|
|
653 |
|
|
654 |
[in-out] NW_TinyDom_Parser_t* parser
|
|
655 |
The parser.
|
|
656 |
|
|
657 |
[in] NW_TinyTree_Offset_t offset
|
|
658 |
Offset into buffer.
|
|
659 |
|
|
660 |
@description: Initialize an attribute handle by parsing an attribute's
|
|
661 |
start token and values, calling the attribute handlers.
|
|
662 |
|
|
663 |
** ----------------------------------------------------------------------- **/
|
|
664 |
void
|
|
665 |
NW_TinyDom_AttributeHandle_init(NW_TinyDom_AttributeHandle_t* handle,
|
|
666 |
NW_TinyDom_Parser_t* parser,
|
|
667 |
NW_TinyTree_Offset_t offset);
|
|
668 |
|
|
669 |
|
|
670 |
/** ----------------------------------------------------------------------- **
|
|
671 |
@function: NW_TinyDom_AttributeHandle_valsIterate
|
|
672 |
|
|
673 |
@synopsis: Iterate over attribute values.
|
|
674 |
|
|
675 |
@scope: public
|
|
676 |
|
|
677 |
@parameters:
|
|
678 |
[in-out] NW_TinyDom_ListIterator_t *it
|
|
679 |
The iterator.
|
|
680 |
|
|
681 |
@description: Initialize an attribute handle by parsing an attribute's
|
|
682 |
start token and values, calling the attribute handlers.
|
|
683 |
|
|
684 |
@returns: NW_TinyTree_Offset_t
|
|
685 |
Offset. If offset is 0, then at end of iteration.
|
|
686 |
|
|
687 |
|
|
688 |
** ----------------------------------------------------------------------- **/
|
|
689 |
NW_TinyTree_Offset_t
|
|
690 |
NW_TinyDom_AttributeHandle_valsIterate(NW_TinyDom_ListIterator_t *it);
|
|
691 |
|
|
692 |
|
|
693 |
/** ----------------------------------------------------------------------- **
|
|
694 |
@function: NW_TinyDom_AttributeHandle_getToken
|
|
695 |
|
|
696 |
@synopsis: Get the token from the handle.
|
|
697 |
|
|
698 |
@scope: public
|
|
699 |
|
|
700 |
@parameters:
|
|
701 |
[in] NW_TinyDom_AttributeHandle_t* handle
|
|
702 |
dThe handle.
|
|
703 |
|
|
704 |
@description: Get the fully qualified token.
|
|
705 |
|
|
706 |
@returns: NW_Uint32
|
|
707 |
Token in handle structure.
|
|
708 |
|
|
709 |
** ----------------------------------------------------------------------- **/
|
|
710 |
NW_Uint32
|
|
711 |
NW_TinyDom_AttributeHandle_getToken(NW_TinyDom_AttributeHandle_t* handle);
|
|
712 |
|
|
713 |
|
|
714 |
/** ----------------------------------------------------------------------- **
|
|
715 |
@function: NW_TinyDom_AttributeHandle_getName
|
|
716 |
|
|
717 |
@synopsis: Get the name from the handle.
|
|
718 |
|
|
719 |
@scope: public
|
|
720 |
|
|
721 |
@parameters:
|
|
722 |
[in] NW_TinyDom_AttributeHandle_t* handle
|
|
723 |
The handle.
|
|
724 |
|
|
725 |
[out] NW_String_t* name
|
|
726 |
The name.
|
|
727 |
|
|
728 |
@description: Get the name, if any, from the handle.
|
|
729 |
|
|
730 |
@returns: NW_Status_t
|
|
731 |
Status of operation.
|
|
732 |
|
|
733 |
[NW_STAT_SUCCESS]
|
|
734 |
Name found.
|
|
735 |
|
|
736 |
[NW_STAT_WBXML_NO_NAME]
|
|
737 |
Name not found.
|
|
738 |
|
|
739 |
[NW_STAT_WBXML_ERROR_BYTECODE]
|
|
740 |
Invalid string in table.
|
|
741 |
|
|
742 |
** ----------------------------------------------------------------------- **/
|
|
743 |
NW_Status_t
|
|
744 |
NW_TinyDom_AttributeHandle_getName(NW_TinyDom_AttributeHandle_t* handle,
|
|
745 |
NW_String_t* name);
|
|
746 |
|
|
747 |
|
|
748 |
/** ----------------------------------------------------------------------- **
|
|
749 |
@function: NW_TinyDom_AttributeHandle_iterateValues
|
|
750 |
|
|
751 |
@synopsis: Iterate the values.
|
|
752 |
|
|
753 |
@scope: public
|
|
754 |
|
|
755 |
@parameters:
|
|
756 |
[in] NW_TinyDom_AttributeHandle_t* handle
|
|
757 |
The handle.
|
|
758 |
|
|
759 |
[out] NW_TinyDom_AttrVal_t* value
|
|
760 |
Attribute value.
|
|
761 |
|
|
762 |
@description: Iterate the values.
|
|
763 |
|
|
764 |
@returns: NW_TinyTree_Offset_t
|
|
765 |
Buffer offset or zero if done.
|
|
766 |
|
|
767 |
** ----------------------------------------------------------------------- **/
|
|
768 |
NW_TinyTree_Offset_t
|
|
769 |
NW_TinyDom_AttributeHandle_iterateValues(NW_TinyDom_AttributeHandle_t* handle,
|
|
770 |
NW_TinyDom_AttrVal_t* value);
|
|
771 |
|
|
772 |
|
|
773 |
/* TODO: Add method to get values as a string */
|
|
774 |
|
|
775 |
|
|
776 |
/** ----------------------------------------------------------------------- **
|
|
777 |
@typedef: NW_TinyDom_TextHandle
|
|
778 |
|
|
779 |
@synopsis: A text handle, for iteration over text components.
|
|
780 |
|
|
781 |
@scope: public
|
|
782 |
@type: NW_TinyDom_AttributeHandle_t
|
|
783 |
|
|
784 |
@description: A text handle, for iteration over text components.
|
|
785 |
** ----------------------------------------------------------------------- **/
|
|
786 |
typedef NW_TinyDom_AttributeHandle_t NW_TinyDom_TextHandle_t;
|
|
787 |
|
|
788 |
|
|
789 |
/** ----------------------------------------------------------------------- **
|
|
790 |
@function: NW_TinyDom_TextHandle_init
|
|
791 |
|
|
792 |
@synopsis: Initialize a text handle.
|
|
793 |
|
|
794 |
@scope: public
|
|
795 |
|
|
796 |
@parameters:
|
|
797 |
[in] NW_TinyDom_TextHandle_t* handle
|
|
798 |
The handle.
|
|
799 |
|
|
800 |
[in] NW_TinyDom_Parser_t* parser
|
|
801 |
The parser.
|
|
802 |
|
|
803 |
[in] NW_TinyTree_Offset_t offset
|
|
804 |
The offset.
|
|
805 |
|
|
806 |
@description: Initialize a text handle.
|
|
807 |
|
|
808 |
** ----------------------------------------------------------------------- **/
|
|
809 |
void
|
|
810 |
NW_TinyDom_TextHandle_init(NW_TinyDom_TextHandle_t* handle,
|
|
811 |
NW_TinyDom_Parser_t* parser,
|
|
812 |
NW_TinyTree_Offset_t offset);
|
|
813 |
|
|
814 |
|
|
815 |
/** ----------------------------------------------------------------------- **
|
|
816 |
@typedef: NW_TinyDom_Text
|
|
817 |
|
|
818 |
@synopsis: Text item types are a subset of attribute value types.
|
|
819 |
|
|
820 |
@scope: public
|
|
821 |
@type: NW_TinyDom_AttrVal_t
|
|
822 |
|
|
823 |
@description: Text item types are a subset of attribute value types.
|
|
824 |
** ----------------------------------------------------------------------- **/
|
|
825 |
typedef NW_TinyDom_AttrVal_t NW_TinyDom_Text_t;
|
|
826 |
|
|
827 |
|
|
828 |
/** ----------------------------------------------------------------------- **
|
|
829 |
@function: NW_TinyDom_TextHandle_iterate
|
|
830 |
|
|
831 |
@synopsis: Text item iterator.
|
|
832 |
|
|
833 |
@scope: public
|
|
834 |
|
|
835 |
@parameters:
|
|
836 |
[in] NW_TinyDom_TextHandle_t* handle
|
|
837 |
The handle.
|
|
838 |
|
|
839 |
[out] NW_TinyDom_Text_t* item
|
|
840 |
The returned text item.
|
|
841 |
@description: Iterate through the text items in a text element, calling
|
|
842 |
the text handlers
|
|
843 |
|
|
844 |
@returns: NW_TinyTree_Offset_t
|
|
845 |
Offset into buffer or zero if no item returned.
|
|
846 |
|
|
847 |
** ----------------------------------------------------------------------- **/
|
|
848 |
NW_TinyTree_Offset_t
|
|
849 |
NW_TinyDom_TextHandle_iterate(NW_TinyDom_TextHandle_t* handle,
|
|
850 |
NW_TinyDom_Text_t* item);
|
|
851 |
|
|
852 |
|
|
853 |
/** ----------------------------------------------------------------------- **
|
|
854 |
@function: NW_TinyDom_getDocHeader
|
|
855 |
|
|
856 |
@synopsis: Get the doc header from the tiny tree.
|
|
857 |
|
|
858 |
@scope: public
|
|
859 |
|
|
860 |
@parameters:
|
|
861 |
[in] NW_TinyTree_t* tree
|
|
862 |
The tree.
|
|
863 |
|
|
864 |
@description: Get the doc header from the tiny tree.
|
|
865 |
|
|
866 |
@returns: NW_WBXML_Document_t*
|
|
867 |
Doc header or NULL if NULL tree.
|
|
868 |
|
|
869 |
** ----------------------------------------------------------------------- **/
|
|
870 |
NW_WBXML_Document_t*
|
|
871 |
NW_TinyDom_getDocHeader(NW_TinyTree_t* tree);
|
|
872 |
|
|
873 |
|
|
874 |
/** ----------------------------------------------------------------------- **
|
|
875 |
@function: NW_TinyDom_getParser
|
|
876 |
|
|
877 |
@synopsis: Get a pointer to the dom parser from the tiny_tree.
|
|
878 |
|
|
879 |
@scope: public
|
|
880 |
|
|
881 |
@parameters:
|
|
882 |
[in] NW_TinyTree_t* tree
|
|
883 |
The tree.
|
|
884 |
|
|
885 |
@description: Get a pointer to the dom parser from the tiny_tree.
|
|
886 |
|
|
887 |
@returns: NW_TinyDom_Parser_t*
|
|
888 |
default
|
|
889 |
|
|
890 |
** ----------------------------------------------------------------------- **/
|
|
891 |
IMPORT_C NW_TinyDom_Parser_t*
|
|
892 |
NW_TinyDom_getParser(NW_TinyTree_t* tree);
|
|
893 |
|
|
894 |
|
|
895 |
/** ----------------------------------------------------------------------- **
|
|
896 |
@function: NW_TinyDom_getTree
|
|
897 |
|
|
898 |
@synopsis: Get a pointer to the dom tree from a tiny tree.
|
|
899 |
|
|
900 |
@scope: public
|
|
901 |
|
|
902 |
@parameters:
|
|
903 |
[in] NW_TinyTree_t* tree
|
|
904 |
The tree.
|
|
905 |
|
|
906 |
@description: Get a pointer to the dom tree from a tiny tree.
|
|
907 |
|
|
908 |
@returns: NW_TinyDom_Tree_t*
|
|
909 |
POinter to the DOM tree or NULL if not found.
|
|
910 |
|
|
911 |
** ----------------------------------------------------------------------- **/
|
|
912 |
IMPORT_C NW_TinyDom_Tree_t*
|
|
913 |
NW_TinyDom_getTree(NW_TinyTree_t* tree);
|
|
914 |
|
|
915 |
/* ----------------------------------------------------------------------- **
|
|
916 |
Dom write support methods: These are created as orphan nodes that
|
|
917 |
then need to be attached to the tree.
|
|
918 |
** ----------------------------------------------------------------------- **/
|
|
919 |
|
|
920 |
/** ----------------------------------------------------------------------- **
|
|
921 |
@function: NW_TinyDom_createAttributeByToken
|
|
922 |
|
|
923 |
@synopsis: Create attribute by token.
|
|
924 |
|
|
925 |
@scope: public
|
|
926 |
|
|
927 |
@parameters:
|
|
928 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
929 |
The DOM tree.
|
|
930 |
|
|
931 |
[in] NW_Uint16 token
|
|
932 |
The token.
|
|
933 |
|
|
934 |
[in] NW_TinyDom_AttrVal_t* value
|
|
935 |
The new attribute.
|
|
936 |
|
|
937 |
@description: Create attribute by token as an orphan node that
|
|
938 |
then need to be attached to the tree.
|
|
939 |
|
|
940 |
@returns: NW_TinyTree_Node_t*
|
|
941 |
Pointer to the new node or NULL if not successful.
|
|
942 |
|
|
943 |
** ----------------------------------------------------------------------- **/
|
|
944 |
NW_TinyTree_Node_t*
|
|
945 |
NW_TinyDom_createAttributeByToken(NW_TinyDom_Tree_t* dom_tree,
|
|
946 |
NW_Uint16 token,
|
|
947 |
NW_TinyDom_AttrVal_t* value);
|
|
948 |
|
|
949 |
|
|
950 |
/** ----------------------------------------------------------------------- **
|
|
951 |
@function: NW_TinyDom_createAttributeByName
|
|
952 |
|
|
953 |
@synopsis: Create attribute by name.
|
|
954 |
|
|
955 |
@scope: public
|
|
956 |
|
|
957 |
@parameters:
|
|
958 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
959 |
The tree.
|
|
960 |
|
|
961 |
[in] NW_String_t* name
|
|
962 |
The name.
|
|
963 |
|
|
964 |
[in] NW_TinyDom_AttrVal_t* value
|
|
965 |
The new attribute.
|
|
966 |
|
|
967 |
@description: Create attribute by name as an orphan node that
|
|
968 |
then need to be attached to the tree.
|
|
969 |
|
|
970 |
@returns: NW_TinyTree_Node_t*
|
|
971 |
Pointer to the new node or NULL if not successful.
|
|
972 |
|
|
973 |
** ----------------------------------------------------------------------- **/
|
|
974 |
NW_TinyTree_Node_t*
|
|
975 |
NW_TinyDom_createAttributeByName(NW_TinyDom_Tree_t* dom_tree,
|
|
976 |
NW_String_t* name,
|
|
977 |
NW_TinyDom_AttrVal_t* value);
|
|
978 |
|
|
979 |
/** ----------------------------------------------------------------------- **
|
|
980 |
@function: NW_TinyDom_AttributeHandle_initWithStartToken
|
|
981 |
|
|
982 |
@synopsis: Initialize the handle with a start token.
|
|
983 |
|
|
984 |
@scope: public
|
|
985 |
|
|
986 |
@parameters:
|
|
987 |
[in] NW_TinyDom_AttributeHandle_t* tinyHandle
|
|
988 |
The handle.
|
|
989 |
|
|
990 |
[out] NW_TinyTree_Node_t** ppNode
|
|
991 |
The tree node.
|
|
992 |
|
|
993 |
[in] NW_TinyDom_Parser_t* parser
|
|
994 |
The parser.
|
|
995 |
|
|
996 |
[in] NW_Uint16 fqToken
|
|
997 |
The token with page.
|
|
998 |
|
|
999 |
@description: Initialize the handle with a start token.
|
|
1000 |
|
|
1001 |
@returns: NW_Status_t
|
|
1002 |
|
|
1003 |
[NW_STAT_SUCCESS]
|
|
1004 |
Success
|
|
1005 |
|
|
1006 |
[NW_STAT_FAILURE]
|
|
1007 |
A failure other than out-of-memory.
|
|
1008 |
|
|
1009 |
[NW_STAT_OUT_OF_MEMORY]
|
|
1010 |
Out of memory.
|
|
1011 |
|
|
1012 |
** ----------------------------------------------------------------------- **/
|
|
1013 |
NW_Status_t
|
|
1014 |
NW_TinyDom_AttributeHandle_initWithStartToken(NW_TinyDom_AttributeHandle_t* tinyHandle,
|
|
1015 |
NW_TinyTree_Node_t** ppNode,
|
|
1016 |
NW_TinyDom_Parser_t* parser,
|
|
1017 |
NW_Uint16 fqToken);
|
|
1018 |
|
|
1019 |
/** ----------------------------------------------------------------------- **
|
|
1020 |
@function: NW_TinyDom_AttributeHandle_addVal
|
|
1021 |
|
|
1022 |
@synopsis: Append the attribute value to the attribute handle.
|
|
1023 |
|
|
1024 |
@scope: public
|
|
1025 |
|
|
1026 |
@parameters:
|
|
1027 |
[in] NW_TinyDom_AttributeHandle_t* tinyHandle
|
|
1028 |
The handle.
|
|
1029 |
|
|
1030 |
[in] NW_TinyTree_Node_t* node
|
|
1031 |
The tree node.
|
|
1032 |
|
|
1033 |
[in] NW_DOM_AttrVal_t* value
|
|
1034 |
The attribute value to append to handle
|
|
1035 |
|
|
1036 |
@description: Append the attribute value to the attribute handle.
|
|
1037 |
|
|
1038 |
@returns: NW_Status_t
|
|
1039 |
|
|
1040 |
[NW_STAT_SUCCESS]
|
|
1041 |
Success
|
|
1042 |
|
|
1043 |
[NW_STAT_FAILURE]
|
|
1044 |
A failure other than out-of-memory.
|
|
1045 |
|
|
1046 |
[NW_STAT_OUT_OF_MEMORY]
|
|
1047 |
Out of memory.
|
|
1048 |
|
|
1049 |
** ----------------------------------------------------------------------- **/
|
|
1050 |
NW_Status_t
|
|
1051 |
NW_TinyDom_AttributeHandle_addVal(NW_TinyDom_AttributeHandle_t* tinyHandle,
|
|
1052 |
NW_TinyTree_Node_t* node,
|
|
1053 |
NW_TinyDom_AttrVal_t* val);
|
|
1054 |
|
|
1055 |
|
|
1056 |
/** ----------------------------------------------------------------------- **
|
|
1057 |
@function: NW_TinyDom_createElementByToken
|
|
1058 |
|
|
1059 |
@synopsis: Create element by token.
|
|
1060 |
|
|
1061 |
@scope: public
|
|
1062 |
|
|
1063 |
@parameters:
|
|
1064 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
1065 |
The tree.
|
|
1066 |
|
|
1067 |
[in] NW_Uint16 token
|
|
1068 |
The token.
|
|
1069 |
|
|
1070 |
@description: Create element by token as an orphan node that
|
|
1071 |
then need to be attached to the tree.
|
|
1072 |
|
|
1073 |
@returns: NW_TinyTree_Node_t*
|
|
1074 |
Pointer to the new node or NULL if not successful.
|
|
1075 |
|
|
1076 |
** ----------------------------------------------------------------------- **/
|
|
1077 |
NW_TinyTree_Node_t*
|
|
1078 |
NW_TinyDom_createElementByToken(NW_TinyDom_Tree_t* dom_tree,
|
|
1079 |
NW_Uint16 token);
|
|
1080 |
|
|
1081 |
|
|
1082 |
/** ----------------------------------------------------------------------- **
|
|
1083 |
@function: NW_TinyDom_createElementByName
|
|
1084 |
|
|
1085 |
@synopsis: Create element by name.
|
|
1086 |
|
|
1087 |
@scope: public
|
|
1088 |
|
|
1089 |
@parameters:
|
|
1090 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
1091 |
The tree.
|
|
1092 |
|
|
1093 |
[in] NW_String_t* name
|
|
1094 |
The name.
|
|
1095 |
|
|
1096 |
@description: Create element by name as an orphan node that
|
|
1097 |
then need to be attached to the tree.
|
|
1098 |
|
|
1099 |
@returns: NW_TinyTree_Node_t*
|
|
1100 |
Pointer to the new node or NULL if not successful.
|
|
1101 |
|
|
1102 |
** ----------------------------------------------------------------------- **/
|
|
1103 |
NW_TinyTree_Node_t*
|
|
1104 |
NW_TinyDom_createElementByName(NW_TinyDom_Tree_t* dom_tree,
|
|
1105 |
NW_String_t* name);
|
|
1106 |
|
|
1107 |
|
|
1108 |
/** ----------------------------------------------------------------------- **
|
|
1109 |
@function: NW_TinyDom_createTextNode
|
|
1110 |
|
|
1111 |
@synopsis: Create text node.
|
|
1112 |
|
|
1113 |
@scope: public
|
|
1114 |
|
|
1115 |
@parameters:
|
|
1116 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
1117 |
The tree.
|
|
1118 |
|
|
1119 |
[in] NW_TinyDom_Text_t* text
|
|
1120 |
The value.
|
|
1121 |
|
|
1122 |
@description: Create element by name as an orphan node that
|
|
1123 |
then needs to be attached to the tree.
|
|
1124 |
|
|
1125 |
@returns: NW_TinyTree_Node_t*
|
|
1126 |
Pointer to the new node or NULL if not successful.
|
|
1127 |
|
|
1128 |
** ----------------------------------------------------------------------- **/
|
|
1129 |
NW_TinyTree_Node_t*
|
|
1130 |
NW_TinyDom_createTextNode(NW_TinyDom_Tree_t* dom_tree,
|
|
1131 |
NW_TinyDom_Text_t* text);
|
|
1132 |
|
|
1133 |
|
|
1134 |
/** ----------------------------------------------------------------------- **
|
|
1135 |
@function: NW_TinyDom_addDataFromTextItem
|
|
1136 |
|
|
1137 |
@synopsis: Adds data to a text node from a text item.
|
|
1138 |
|
|
1139 |
@scope: public
|
|
1140 |
|
|
1141 |
@parameters:
|
|
1142 |
[in] NW_TinyTree_t* tinyTree
|
|
1143 |
The tree.
|
|
1144 |
|
|
1145 |
[in] NW_TinyDom_Tree_t* tinyDomTree
|
|
1146 |
The DOM tree.
|
|
1147 |
|
|
1148 |
[in] NW_TinyTree_Node_t* node
|
|
1149 |
The text node.
|
|
1150 |
|
|
1151 |
[in] NW_TinyTree_Text_t text
|
|
1152 |
The value.
|
|
1153 |
|
|
1154 |
[in] NW_Uint32 encoding
|
|
1155 |
The IANA MIBenum for the character encoding.
|
|
1156 |
|
|
1157 |
@description: Adds data to a text node from a text item.
|
|
1158 |
|
|
1159 |
@returns: NW_Status_t
|
|
1160 |
Status of operation.
|
|
1161 |
|
|
1162 |
[NW_STAT_SUCCESS]
|
|
1163 |
Data added.
|
|
1164 |
|
|
1165 |
[NW_STAT_FAILURE]
|
|
1166 |
Data not added.
|
|
1167 |
|
|
1168 |
** ----------------------------------------------------------------------- **/
|
|
1169 |
NW_Status_t
|
|
1170 |
NW_TinyDom_addDataFromTextItem(NW_TinyTree_t* tinyTree,
|
|
1171 |
NW_TinyDom_Tree_t* tinyDomTree,
|
|
1172 |
NW_TinyTree_Node_t* node,
|
|
1173 |
NW_TinyDom_Text_t* val,
|
|
1174 |
NW_Uint32 encoding);
|
|
1175 |
|
|
1176 |
|
|
1177 |
/** ----------------------------------------------------------------------- **
|
|
1178 |
@function: NW_TinyDom_Tree_create
|
|
1179 |
|
|
1180 |
@synopsis: Create a new tree.
|
|
1181 |
|
|
1182 |
@scope: public
|
|
1183 |
|
|
1184 |
@parameters:
|
|
1185 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
1186 |
The DOM tree.
|
|
1187 |
|
|
1188 |
[in] NW_TinyDom_Parser_t* dom_parser
|
|
1189 |
The parser to associate with this tree.
|
|
1190 |
|
|
1191 |
[in] NW_WBXML_Document_t* doc
|
|
1192 |
The source document.
|
|
1193 |
|
|
1194 |
[in] NW_WBXML_Parser_t* parser
|
|
1195 |
The WBXML parser.
|
|
1196 |
|
|
1197 |
[in] NW_WBXML_Writer_t* writer
|
|
1198 |
Tree writer.
|
|
1199 |
|
|
1200 |
[in] NW_Uint16 init_node_count
|
|
1201 |
Initial allocation.
|
|
1202 |
|
|
1203 |
[in] NW_Bool enableStringTable
|
|
1204 |
Set to true for normal WBXML. Set to false to disable
|
|
1205 |
writing from using a string table.
|
|
1206 |
|
|
1207 |
@description: Create a new tree.
|
|
1208 |
|
|
1209 |
@returns: NW_Status_t
|
|
1210 |
Status of operation.
|
|
1211 |
|
|
1212 |
[NW_STAT_SUCCESS]
|
|
1213 |
Tree created.
|
|
1214 |
|
|
1215 |
[NW_STAT_FAILURE]
|
|
1216 |
Dictionary not found or root node not created.
|
|
1217 |
|
|
1218 |
** ----------------------------------------------------------------------- **/
|
|
1219 |
NW_Status_t
|
|
1220 |
NW_TinyDom_Tree_create(NW_TinyDom_Tree_t* dom_tree,
|
|
1221 |
NW_TinyDom_Parser_t* dom_parser,
|
|
1222 |
NW_WBXML_Document_t* doc,
|
|
1223 |
NW_WBXML_Parser_t* parser,
|
|
1224 |
NW_WBXML_Writer_t* writer,
|
|
1225 |
NW_Uint16 init_node_count,
|
|
1226 |
NW_Bool enableStringTable);
|
|
1227 |
|
|
1228 |
|
|
1229 |
/** ----------------------------------------------------------------------- **
|
|
1230 |
@function: NW_TinyDom_writeDocHeader
|
|
1231 |
|
|
1232 |
@synopsis: Write doc header.
|
|
1233 |
|
|
1234 |
@scope: public
|
|
1235 |
|
|
1236 |
@parameters:
|
|
1237 |
[in] NW_TinyDom_Tree_t* dom_tree
|
|
1238 |
The tree.
|
|
1239 |
|
|
1240 |
[in] NW_Uint8 version
|
|
1241 |
The version.
|
|
1242 |
|
|
1243 |
[in] NW_Uint32 publicid
|
|
1244 |
The dictionary public ID.
|
|
1245 |
|
|
1246 |
[in] NW_Uint32 encoding
|
|
1247 |
Character encoding.
|
|
1248 |
|
|
1249 |
@description: Write doc header.
|
|
1250 |
|
|
1251 |
@returns: NW_TinyTree_Node_t*
|
|
1252 |
New node or NULL if not successful.
|
|
1253 |
|
|
1254 |
** ----------------------------------------------------------------------- **/
|
|
1255 |
NW_TinyTree_Node_t*
|
|
1256 |
NW_TinyDom_writeDocHeader(NW_TinyDom_Tree_t* dom_tree,
|
|
1257 |
NW_Uint8 version,
|
|
1258 |
NW_Uint32 publicid,
|
|
1259 |
NW_Uint32 encoding);
|
|
1260 |
|
|
1261 |
|
|
1262 |
/** ----------------------------------------------------------------------- **
|
|
1263 |
@function: NW_TinyDom_removeAttrFromListNode
|
|
1264 |
|
|
1265 |
@synopsis: Remove attribute from list node.
|
|
1266 |
|
|
1267 |
@scope: public
|
|
1268 |
|
|
1269 |
@parameters:
|
|
1270 |
[in] NW_TinyDom_AttrListHandle_t* h
|
|
1271 |
The handle.
|
|
1272 |
|
|
1273 |
[in] NW_Uint32 length
|
|
1274 |
Length of attribute.
|
|
1275 |
|
|
1276 |
@description: Remove attribute from list node.
|
|
1277 |
|
|
1278 |
@returns: NW_Status_t
|
|
1279 |
Success of operation.
|
|
1280 |
|
|
1281 |
[NW_STAT_SUCCESS]
|
|
1282 |
Always returns success.
|
|
1283 |
|
|
1284 |
** ----------------------------------------------------------------------- **/
|
|
1285 |
NW_Status_t
|
|
1286 |
NW_TinyDom_removeAttrFromListNode(NW_TinyDom_AttrListHandle_t* h,
|
|
1287 |
NW_Uint32 length);
|
|
1288 |
|
|
1289 |
void
|
|
1290 |
NW_TinyDom_setLastValid(NW_TinyDom_Tree_t* dom_tree, NW_Int32 lastValid);
|
|
1291 |
|
|
1292 |
NW_Int32
|
|
1293 |
NW_TinyDom_getLastValid(NW_TinyDom_Tree_t* dom_tree);
|
|
1294 |
|
|
1295 |
#ifdef __cplusplus
|
|
1296 |
} /* extern "C" { */
|
|
1297 |
#endif /* __cplusplus */
|
|
1298 |
|
|
1299 |
|
|
1300 |
#endif /* NW_TINY_DOM_H */
|