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_DOM |
|
21 |
|
22 @synopsis: default |
|
23 |
|
24 @description: default |
|
25 |
|
26 ** ----------------------------------------------------------------------- **/ |
|
27 #ifndef NW_DOM_DOCUMENT_H |
|
28 #define NW_DOM_DOCUMENT_H |
|
29 |
|
30 #include <xml/cxml/cxml_proj.h> |
|
31 #include <xml/cxml/nw_dom_node.h> |
|
32 #include <xml/cxml/nw_dom_text.h> |
|
33 #include <xml/cxml/nw_dom_element.h> |
|
34 #include <xml/cxml/nw_wbxml_dictionary.h> |
|
35 |
|
36 #ifdef __cplusplus |
|
37 extern "C" { |
|
38 #endif /* __cplusplus */ |
|
39 |
|
40 |
|
41 /** ----------------------------------------------------------------------- ** |
|
42 @function: NW_DOM_DocumentNode_getPublicIdAsNumber |
|
43 |
|
44 @synopsis: Gets the public id of the document as an integer. |
|
45 |
|
46 @scope: public |
|
47 |
|
48 @parameters: |
|
49 [in] NW_DOM_DocumentNode_t* d |
|
50 The document node. |
|
51 |
|
52 @description: Gets the public id of the document as an integer. |
|
53 |
|
54 @returns: NW_Uint32 |
|
55 publicID or 0 |
|
56 |
|
57 ** ----------------------------------------------------------------------- **/ |
|
58 IMPORT_C NW_Uint32 |
|
59 NW_DOM_DocumentNode_getPublicIdAsNumber(NW_DOM_DocumentNode_t* d); |
|
60 |
|
61 |
|
62 /** ----------------------------------------------------------------------- ** |
|
63 |
|
64 @function: NW_DOM_DocumentNode_getPublicId |
|
65 |
|
66 @synopsis: Gets the publicid of the document as string (docType). |
|
67 |
|
68 @scope: public |
|
69 |
|
70 @parameters: |
|
71 [in] NW_DOM_DocumentNode_t* d |
|
72 The document node. |
|
73 |
|
74 [out] NW_String_t* str |
|
75 The public id as a string. |
|
76 |
|
77 @description: The document type declaration associated with this |
|
78 document is returned. |
|
79 |
|
80 @returns: NW_Status_t |
|
81 Status of operation. |
|
82 |
|
83 [NW_STAT_DOM_NODE_TYPE_ERR] |
|
84 Error reading node. |
|
85 |
|
86 [NW_STAT_SUCCESS] |
|
87 Success. |
|
88 |
|
89 ** ----------------------------------------------------------------------- **/ |
|
90 IMPORT_C NW_Status_t |
|
91 NW_DOM_DocumentNode_getPublicId(NW_DOM_DocumentNode_t* d, |
|
92 NW_String_t* str); |
|
93 |
|
94 |
|
95 /** ----------------------------------------------------------------------- ** |
|
96 @function: NW_DOM_DocumentNode_getVersion |
|
97 |
|
98 @synopsis: Returns the version of the document, |
|
99 |
|
100 @scope: public |
|
101 |
|
102 @parameters: |
|
103 [in] NW_DOM_DocumentNode_t* doc |
|
104 The document node. |
|
105 |
|
106 @description: Returns the version of the document. Returns 0 if this |
|
107 is not valid. |
|
108 |
|
109 @returns: NW_Uint8 |
|
110 Version number or 0. |
|
111 |
|
112 ** ----------------------------------------------------------------------- **/ |
|
113 IMPORT_C NW_Uint8 |
|
114 NW_DOM_DocumentNode_getVersion(NW_DOM_DocumentNode_t* doc); |
|
115 |
|
116 |
|
117 /** ----------------------------------------------------------------------- ** |
|
118 @function: NW_DOM_DocumentNode_getCharacterEncoding |
|
119 |
|
120 @synopsis: Returns the supported encoding of the document. |
|
121 |
|
122 @scope: public |
|
123 |
|
124 @parameters: |
|
125 [in] NW_DOM_DocumentNode_t* doc |
|
126 The document node. |
|
127 |
|
128 @description: Returns the supported encoding of the document or 0 |
|
129 for invalid document. |
|
130 |
|
131 @returns: NW_Uint32 |
|
132 Encoding or 0. |
|
133 |
|
134 ** ----------------------------------------------------------------------- **/ |
|
135 IMPORT_C NW_Uint32 |
|
136 NW_DOM_DocumentNode_getCharacterEncoding(NW_DOM_DocumentNode_t* doc); |
|
137 |
|
138 |
|
139 /** ----------------------------------------------------------------------- ** |
|
140 @function: NW_DOM_DocumentNode_getDocumentElement |
|
141 |
|
142 @synopsis: Returns child node that is the root of this document |
|
143 |
|
144 @scope: public |
|
145 |
|
146 @parameters: |
|
147 [in] NW_DOM_DocumentNode_t* doc |
|
148 The document node. |
|
149 |
|
150 @description: Returns child node that is the root of this document |
|
151 |
|
152 @returns: NW_DOM_DocumentNode_t* |
|
153 Child node that is the root element of the document; |
|
154 NULL if doc is not a document node. |
|
155 |
|
156 ** ----------------------------------------------------------------------- **/ |
|
157 IMPORT_C NW_DOM_ElementNode_t* |
|
158 NW_DOM_DocumentNode_getDocumentElement(NW_DOM_DocumentNode_t* doc); |
|
159 |
|
160 |
|
161 /** ----------------------------------------------------------------------- ** |
|
162 @function: NW_DOM_DocumentNode_getElementIteratorByTagName |
|
163 |
|
164 @synopsis: Gets the handle to iterate over elements of a given name. |
|
165 |
|
166 @scope: public |
|
167 |
|
168 @parameters: |
|
169 [in] NW_DOM_DocumentNode_t* doc |
|
170 The document node. |
|
171 |
|
172 [in] NW_String_t* tagName |
|
173 Name of the element. |
|
174 |
|
175 [out] NW_DOM_NodeIterator_t* handle |
|
176 Iterator to iterate over nodes of same name) |
|
177 |
|
178 @description: Gets the handle to iterate over elements of a given name. |
|
179 |
|
180 @returns: NW_Status_t |
|
181 Status of operation. |
|
182 |
|
183 [NW_STAT_SUCCESS] |
|
184 Success |
|
185 |
|
186 [NW_STAT_FAILURE] |
|
187 Failure |
|
188 |
|
189 [NW_STAT_DOM_NODE_TYPE_ERR] |
|
190 Not NW_DOM_DOCUMENT_NODE. |
|
191 |
|
192 ** ----------------------------------------------------------------------- **/ |
|
193 NW_Status_t |
|
194 NW_DOM_DocumentNode_getElementIteratorByTagName(NW_DOM_DocumentNode_t* doc, |
|
195 NW_String_t* tagName, |
|
196 NW_DOM_NodeIterator_t* handle); |
|
197 |
|
198 |
|
199 /** ----------------------------------------------------------------------- ** |
|
200 @function: NW_DOM_DocumentNode_getElementIteratorByTagToken |
|
201 |
|
202 @synopsis: Gets the iterator to iterate over elements of a given token. |
|
203 |
|
204 @scope: public |
|
205 |
|
206 @parameters: |
|
207 [in] NW_DOM_DocumentNode_t* doc |
|
208 The document node. |
|
209 |
|
210 [in] NW_Uint16 token |
|
211 Token of the element to be found. |
|
212 |
|
213 [out] NW_DOM_NodeIterator_t* handle |
|
214 Iterator to iterate over nodes of same name. |
|
215 |
|
216 @description: Gets the iterator to iterate over elements of a given token. |
|
217 |
|
218 @returns: NW_Status_t |
|
219 Status of operation. |
|
220 |
|
221 [NW_STAT_SUCCESS] |
|
222 Success |
|
223 |
|
224 [NW_STAT_DOM_NODE_TYPE_ERR] |
|
225 Not NW_DOM_DOCUMENT_NODE. |
|
226 |
|
227 ** ----------------------------------------------------------------------- **/ |
|
228 NW_Status_t |
|
229 NW_DOM_DocumentNode_getElementIteratorByTagToken(NW_DOM_DocumentNode_t* doc, |
|
230 NW_Uint16 token, |
|
231 NW_DOM_NodeIterator_t* handle); |
|
232 |
|
233 |
|
234 /** ----------------------------------------------------------------------- ** |
|
235 @function: NW_DOM_DocumentNode_getDictionary |
|
236 |
|
237 @synopsis: Returns dictionary used by this document |
|
238 |
|
239 @scope: public |
|
240 |
|
241 @parameters: |
|
242 [in] NW_DOM_DocumentNode_t* doc |
|
243 The document node. |
|
244 |
|
245 @description: Returns dictionary used by this document |
|
246 |
|
247 @returns: NW_WBXML_Dictionary_t* |
|
248 Dictionary or null if not found. |
|
249 ** ----------------------------------------------------------------------- **/ |
|
250 IMPORT_C NW_WBXML_Dictionary_t* |
|
251 NW_DOM_DocumentNode_getDictionary(NW_DOM_DocumentNode_t* doc); |
|
252 |
|
253 |
|
254 /** ----------------------------------------------------------------------- ** |
|
255 @function: NW_DOM_DocumentNode_createElementNode |
|
256 |
|
257 @synopsis: Creates a new element with the given name. |
|
258 |
|
259 @scope: public |
|
260 |
|
261 @parameters: |
|
262 [in] NW_DOM_DocumentNode_t* doc |
|
263 The document node. |
|
264 |
|
265 [in] NW_String_t* name |
|
266 Name of the element to be created. |
|
267 |
|
268 @description: Creates a new element with the given name. |
|
269 |
|
270 @returns: NW_DOM_ElementNode_t* |
|
271 New element with the given name; NULL if doc is not a |
|
272 document node. |
|
273 ** ----------------------------------------------------------------------- **/ |
|
274 IMPORT_C NW_DOM_ElementNode_t* |
|
275 NW_DOM_DocumentNode_createElementNode(NW_DOM_DocumentNode_t* doc, NW_String_t* name); |
|
276 |
|
277 |
|
278 /** ----------------------------------------------------------------------- ** |
|
279 @function: NW_DOM_DocumentNode_createElementNodeByToken |
|
280 |
|
281 @synopsis: Creates a new element with the given token. |
|
282 |
|
283 @scope: public |
|
284 |
|
285 @parameters: |
|
286 [in] NW_DOM_DocumentNode_t* doc |
|
287 The document node. |
|
288 |
|
289 [in] NW_Uint16 token |
|
290 Token of the element to be created. |
|
291 |
|
292 @description: Creates a new element with the given token. |
|
293 |
|
294 @returns: NW_DOM_ElementNode_t* |
|
295 New element with the given token; NULL if doc is not a |
|
296 document node or token is an invalid token. |
|
297 |
|
298 ** ----------------------------------------------------------------------- **/ |
|
299 IMPORT_C NW_DOM_ElementNode_t* |
|
300 NW_DOM_DocumentNode_createElementNodeByToken( |
|
301 NW_DOM_DocumentNode_t* doc, NW_Uint16 token); |
|
302 |
|
303 |
|
304 /** ----------------------------------------------------------------------- ** |
|
305 @function: NW_DOM_DocumentNode_createTextNodeWithTextItem |
|
306 |
|
307 @synopsis: Returns a pointer to the created Text Node. |
|
308 |
|
309 @scope: public |
|
310 |
|
311 @parameters: |
|
312 [in] NW_DOM_DocumentNode_t* doc |
|
313 The document node. |
|
314 |
|
315 [in] NW_DOM_TextItem_t* data |
|
316 The value for the new text node. |
|
317 |
|
318 @description: Returns a pointer to the created Text Node. |
|
319 |
|
320 @returns: NW_DOM_TextNode_t* |
|
321 New text node; NULL if if doc is not a document node. |
|
322 |
|
323 ** ----------------------------------------------------------------------- **/ |
|
324 IMPORT_C NW_DOM_TextNode_t* |
|
325 NW_DOM_DocumentNode_createTextNodeWithTextItem( |
|
326 NW_DOM_DocumentNode_t* doc, NW_DOM_TextItem_t* data); |
|
327 |
|
328 |
|
329 /** ----------------------------------------------------------------------- ** |
|
330 @function: NW_DOM_DocumentNode_createTextNode |
|
331 |
|
332 @synopsis: Creates a text node. |
|
333 |
|
334 @scope: public |
|
335 |
|
336 @parameters: |
|
337 [in] NW_DOM_DocumentNode_t* doc |
|
338 The document node. |
|
339 |
|
340 [in] NW_String_t* data |
|
341 The value for the new text node. |
|
342 |
|
343 @description: Creates a text node with the given data. |
|
344 |
|
345 @returns: NW_DOM_TextNode_t* |
|
346 New text node; NULL if if doc is not a document node. |
|
347 |
|
348 ** ----------------------------------------------------------------------- **/ |
|
349 IMPORT_C NW_DOM_TextNode_t* |
|
350 NW_DOM_DocumentNode_createTextNode(NW_DOM_DocumentNode_t* doc, NW_String_t* data); |
|
351 |
|
352 |
|
353 /** ----------------------------------------------------------------------- ** |
|
354 @function: NW_DOM_DocumentNode_createCommentNode |
|
355 |
|
356 @synopsis: Creates a comment node with the given data. |
|
357 |
|
358 @scope: public |
|
359 |
|
360 @parameters: |
|
361 [in] NW_DOM_DocumentNode_t* doc |
|
362 The document node. |
|
363 |
|
364 [in] NW_String_t* data |
|
365 Value for the new comment node. |
|
366 |
|
367 @description: Creates a comment node with the given data. |
|
368 |
|
369 @returns: NW_DOM_CommentNode_t* |
|
370 New comment node; NULL if doc is not a document node. |
|
371 |
|
372 ** ----------------------------------------------------------------------- **/ |
|
373 NW_DOM_CommentNode_t* |
|
374 NW_DOM_DocumentNode_createCommentNode(NW_DOM_DocumentNode_t* doc, |
|
375 NW_String_t* data); |
|
376 |
|
377 |
|
378 /** ----------------------------------------------------------------------- ** |
|
379 @function: NW_DOM_DocumentNode_createCDATASectionNode |
|
380 |
|
381 @synopsis: Creates a CDATA section. |
|
382 |
|
383 @scope: public |
|
384 |
|
385 @parameters: |
|
386 [in] NW_DOM_DocumentNode_t* doc |
|
387 The document node. |
|
388 |
|
389 [in] NW_String_t* data |
|
390 The value for the new CDATA section node. |
|
391 |
|
392 @description: Creates a CDATA section node with the given data. |
|
393 |
|
394 @returns: NW_DOM_CDATASectionNode_t* |
|
395 New CData section node; NULL if doc is not a document node. |
|
396 |
|
397 ** ----------------------------------------------------------------------- **/ |
|
398 NW_DOM_CDATASectionNode_t* |
|
399 NW_DOM_DocumentNode_createCDATASectionNode(NW_DOM_DocumentNode_t* doc, |
|
400 NW_String_t* data); |
|
401 |
|
402 |
|
403 /** ----------------------------------------------------------------------- ** |
|
404 @function: NW_DOM_DocumentNode_createProcessingInstructionNodeByAttrVal |
|
405 |
|
406 @synopsis: Creates a processing instruction node. |
|
407 |
|
408 @scope: public |
|
409 |
|
410 @parameters: |
|
411 [in] NW_DOM_DocumentNode_t* doc |
|
412 The document node. |
|
413 |
|
414 [in] NW_String_t* target |
|
415 The target for the processing instruction. |
|
416 |
|
417 [in] NW_DOM_AttrVal_t* data |
|
418 Data for the processing instruction. |
|
419 |
|
420 @description: Creates a processing instruction node with the given data. |
|
421 In WBXML, a processing instruction node can have a combination |
|
422 of opaque, string, token, extension, and entity as the data. |
|
423 |
|
424 @returns: NW_DOM_ProcessingInstructionNode_t* |
|
425 New processing instruction node; NULL if this is a node |
|
426 type mismatch. |
|
427 |
|
428 ** ----------------------------------------------------------------------- **/ |
|
429 NW_DOM_ProcessingInstructionNode_t* |
|
430 NW_DOM_DocumentNode_createProcessingInstructionNodeByAttrVal( |
|
431 NW_DOM_DocumentNode_t* doc, NW_String_t* target, NW_DOM_AttrVal_t* data); |
|
432 |
|
433 |
|
434 /** ----------------------------------------------------------------------- ** |
|
435 @function: NW_DOM_DocumentNode_createProcessingInstructionNodeByToken |
|
436 |
|
437 @synopsis: Creates a processing instruction node. |
|
438 |
|
439 @scope: public |
|
440 |
|
441 @parameters: |
|
442 |
|
443 [in] NW_DOM_DocumentNode_t* doc |
|
444 The document node. |
|
445 |
|
446 [in] NW_Uint16 token |
|
447 Token identifying the target. |
|
448 |
|
449 [in] NW_DOM_AttrVal_t* data |
|
450 Data for the processing instruction. |
|
451 |
|
452 @description: Creates a processing instruction node with the given data. |
|
453 In WBXML, a processing instruction node can have a combination |
|
454 of opaque, string, token, extension, and entity as the data. |
|
455 |
|
456 @returns: NW_DOM_ProcessingInstructionNode_t* |
|
457 New processing instruction node; NULL if this is a node type |
|
458 mismatch. |
|
459 |
|
460 ** ----------------------------------------------------------------------- **/ |
|
461 NW_DOM_ProcessingInstructionNode_t* |
|
462 NW_DOM_DocumentNode_createProcessingInstructionNodeByToken( |
|
463 NW_DOM_DocumentNode_t* doc, NW_Uint16 token, NW_DOM_AttrVal_t* data); |
|
464 |
|
465 |
|
466 /** ----------------------------------------------------------------------- ** |
|
467 @function: NW_DOM_DocumentNode_createProcessingInstructionNode |
|
468 |
|
469 @synopsis: Creates a processing instruction node. |
|
470 |
|
471 @scope: public |
|
472 |
|
473 @parameters: |
|
474 [in] NW_DOM_DocumentNode_t* doc |
|
475 The document node. |
|
476 |
|
477 [in] NW_String_t* target |
|
478 The target for the processing instruction. |
|
479 |
|
480 [in] NW_String_t* data |
|
481 Data for the processing instruction. |
|
482 |
|
483 @description: Creates a processing instruction node with the given data. |
|
484 |
|
485 @returns: NW_DOM_ProcessingInstructionNode_t* |
|
486 New processing instruction node; NULL if doc is not a document |
|
487 node. |
|
488 |
|
489 ** ----------------------------------------------------------------------- **/ |
|
490 NW_DOM_ProcessingInstructionNode_t* |
|
491 NW_DOM_DocumentNode_createProcessingInstructionNode( |
|
492 NW_DOM_DocumentNode_t* doc, NW_String_t* target, NW_String_t* data); |
|
493 |
|
494 |
|
495 /** ----------------------------------------------------------------------- ** |
|
496 @struct: NW_TinyDom_Handle |
|
497 |
|
498 @synopsis: A handle to hold all the state required to build a tree. |
|
499 |
|
500 @scope: public |
|
501 @variables: |
|
502 NW_WBXML_Parser_t wbxmlParser |
|
503 WBXML parser |
|
504 |
|
505 NW_TinyDom_Parser_t tinyParser |
|
506 Tiny parser |
|
507 |
|
508 NW_TinyDom_Tree_t tinyDOMTree |
|
509 Tiny DOM tree |
|
510 |
|
511 NW_WBXML_Writer_t writer |
|
512 WBXML writer |
|
513 |
|
514 NW_WBXML_Document_t document |
|
515 WBXML document |
|
516 |
|
517 @description: A handle to hold all the state required to build a tree. |
|
518 ** ----------------------------------------------------------------------- **/ |
|
519 typedef struct NW_TinyDom_Handle_s{ |
|
520 NW_WBXML_Parser_t wbxmlParser; |
|
521 NW_TinyDom_Parser_t tinyParser; |
|
522 NW_TinyDom_Tree_t tinyDOMTree; |
|
523 NW_WBXML_Writer_t writer; |
|
524 NW_WBXML_Document_t document; |
|
525 } NW_TinyDom_Handle_t; |
|
526 |
|
527 |
|
528 /* "Factory methods" that generate a dom tree and return the tree |
|
529 * root as a document node |
|
530 */ |
|
531 |
|
532 |
|
533 /** ----------------------------------------------------------------------- ** |
|
534 @function: NW_DOM_DocumentNode_BuildTree |
|
535 |
|
536 @synopsis: Create a dom tree by parsing a buffer. |
|
537 |
|
538 @scope: public |
|
539 |
|
540 @parameters: |
|
541 [in] NW_TinyDom_Handle_t* h |
|
542 Handle for new tree. |
|
543 |
|
544 [in] NW_Byte* buffer |
|
545 Buffer to parse. |
|
546 |
|
547 [in] NW_Int32 length |
|
548 Length of buffer. |
|
549 |
|
550 [in] NW_Bool encoded |
|
551 Encoded if true, otherwise text. |
|
552 |
|
553 [in] NW_Uint32 publicID |
|
554 Dictionary to apply. |
|
555 |
|
556 |
|
557 [in] NW_Bool extTNotStringTable |
|
558 If NW_FALSE then extension tokens EXT_T_[0,1,2] have |
|
559 an associated index into the string table. If NW_TRUE |
|
560 then the NW_Uint32 associated with EXT_T_[0,1,2] is |
|
561 just an anonymous value. |
|
562 |
|
563 @description: Create a dom tree by parsing a buffer. |
|
564 |
|
565 @returns: NW_DOM_DocumentNode_t* |
|
566 Node of created tree. |
|
567 |
|
568 ** ----------------------------------------------------------------------- **/ |
|
569 IMPORT_C NW_DOM_DocumentNode_t* |
|
570 NW_DOM_DocumentNode_BuildTree(NW_TinyDom_Handle_t* h, |
|
571 NW_Byte* buffer, |
|
572 NW_Int32 length, |
|
573 NW_Bool encoded, |
|
574 NW_Uint32 publicID, |
|
575 NW_Bool extTNotStringTable); |
|
576 |
|
577 |
|
578 |
|
579 /* ************************************************************************/ |
|
580 |
|
581 /* |
|
582 * Create and populate a dom tree by parsing a buffer, returning the |
|
583 * document node. |
|
584 */ |
|
585 IMPORT_C |
|
586 NW_DOM_DocumentNode_t * |
|
587 NW_DOM_DocumentNode_BuildWBXMLTree(NW_TinyDom_Handle_t *h, |
|
588 NW_Byte *buffer, |
|
589 NW_Int32 length, |
|
590 NW_Bool freeBuff, |
|
591 NW_Bool extTNotStringTable); |
|
592 |
|
593 /** ----------------------------------------------------------------------- ** |
|
594 @function: NW_DOM_DocumentNode_createDocumentWithNumberPublicId |
|
595 |
|
596 @synopsis: Create an empty dom tree. |
|
597 |
|
598 @scope: public |
|
599 |
|
600 @parameters: |
|
601 [in] NW_TinyDom_Handle_t* h |
|
602 The tiny DOM handle. |
|
603 |
|
604 [in] NW_Uint8 version |
|
605 Version of the document to be created. |
|
606 |
|
607 [in] NW_Uint32 publicid |
|
608 Unique identifier for the DTD. |
|
609 |
|
610 [in] NW_Uint32 encoding |
|
611 Encoding for the document. |
|
612 |
|
613 [in] NW_Bool extTNotStringTable |
|
614 If NW_FALSE then extension tokens EXT_T_[0,1,2] have |
|
615 an associated index into the string table. If NW_TRUE |
|
616 then the NW_Uint32 associated with EXT_T_[0,1,2] is |
|
617 just an anonymous value. |
|
618 |
|
619 [in] NW_Bool enableStringTable |
|
620 Set to true for noraml WBXML. Set to false to prevent |
|
621 writable DOM from using a string table. |
|
622 |
|
623 |
|
624 @description: Create an empty dom tree. |
|
625 In XML and HTML, a public id identifying the DTD is in |
|
626 string form, but in WBXML sometimes numbers identify the |
|
627 well-known DTDs. Thus, there is a need for two methods for |
|
628 document creation. |
|
629 |
|
630 @returns: NW_DOM_DocumentNode_t* |
|
631 New document node; NULL if error during creation. |
|
632 |
|
633 ** ----------------------------------------------------------------------- **/ |
|
634 IMPORT_C NW_DOM_DocumentNode_t* |
|
635 NW_DOM_DocumentNode_createDocumentWithNumberPublicId(NW_TinyDom_Handle_t* h, |
|
636 NW_Uint8 version, |
|
637 NW_Uint32 publicid, |
|
638 NW_Uint32 encoding, |
|
639 NW_Bool extTNotStringTable, |
|
640 NW_Bool enableStringTable); |
|
641 |
|
642 /** ----------------------------------------------------------------------- ** |
|
643 @function: CXML_DOM_DocumentNode_BuildTree |
|
644 |
|
645 @synopsis: Create a dom tree by parsing a buffer and retuen the error |
|
646 status also. |
|
647 |
|
648 @scope: public |
|
649 |
|
650 @parameters: |
|
651 [in] NW_TinyDom_Handle_t* h |
|
652 Handle for new tree. |
|
653 |
|
654 [in] NW_Byte* buffer |
|
655 Buffer to parse. |
|
656 |
|
657 [in] NW_Int32 length |
|
658 Length of buffer. |
|
659 |
|
660 [in] NW_Bool encoded |
|
661 Encoded if true, otherwise text. |
|
662 |
|
663 [in] NW_Uint32 publicID |
|
664 Dictionary to apply. |
|
665 |
|
666 |
|
667 [in] NW_Bool extTNotStringTable |
|
668 If NW_FALSE then extension tokens EXT_T_[0,1,2] have |
|
669 an associated index into the string table. If NW_TRUE |
|
670 then the NW_Uint32 associated with EXT_T_[0,1,2] is |
|
671 just an anonymous value. |
|
672 |
|
673 [out] NW_Status_t* errorStatus |
|
674 Returns the error status code as defined in the WBXML |
|
675 parser if any error is occured during the parsing of WBXML. |
|
676 If DOM tree is created successfully then this return NW_STAT_SUCCESS. |
|
677 |
|
678 @description: Create a dom tree by parsing a buffer. |
|
679 |
|
680 @returns: NW_DOM_DocumentNode_t* |
|
681 Node of created tree. |
|
682 |
|
683 ** ----------------------------------------------------------------------- **/ |
|
684 IMPORT_C NW_DOM_DocumentNode_t* |
|
685 CXML_DOM_DocumentNode_BuildTree(NW_TinyDom_Handle_t* h, |
|
686 NW_Byte* buffer, |
|
687 NW_Int32 length, |
|
688 NW_Bool encoded, |
|
689 NW_Uint32 publicID, |
|
690 NW_Bool extTNotStringTable, |
|
691 NW_Status_t* errorStatus); |
|
692 |
|
693 |
|
694 /** ----------------------------------------------------------------------- ** |
|
695 @function: NW_DOM_DocumentNode_Delete |
|
696 |
|
697 @synopsis: Free the tree created by one of the above methods. |
|
698 |
|
699 @scope: public |
|
700 |
|
701 @parameters: |
|
702 [in-out] NW_DOM_DocumentNode_t* docNode |
|
703 Tree to free. |
|
704 |
|
705 @description: Free the tree created by one of the above methods. |
|
706 |
|
707 ** ----------------------------------------------------------------------- **/ |
|
708 IMPORT_C void |
|
709 NW_DOM_DocumentNode_Delete(NW_DOM_DocumentNode_t* docNode); |
|
710 |
|
711 #ifdef __cplusplus |
|
712 } /* extern "C" { */ |
|
713 #endif /* __cplusplus */ |
|
714 |
|
715 #endif /* NW_DOM_DOCUMENT_H */ |
|