94
|
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 |
@package: NW_HED
|
|
20 |
|
|
21 |
@synopsis: Convenience functions for accessing the DOM.
|
|
22 |
|
|
23 |
@description: default
|
|
24 |
|
|
25 |
** ----------------------------------------------------------------------- **/
|
|
26 |
|
|
27 |
#ifndef NW_HED_DOM_HELPER_H
|
|
28 |
#define NW_HED_DOM_HELPER_H
|
|
29 |
|
|
30 |
#include <nw_dom_node.h>
|
|
31 |
#include <nw_string_string.h>
|
|
32 |
#include "nw_hed_context.h"
|
|
33 |
#include "nw_hed_entityset.h"
|
|
34 |
#include "BrsrStatusCodes.h"
|
|
35 |
|
|
36 |
#ifdef __cplusplus
|
|
37 |
extern "C" {
|
|
38 |
#endif /* __cplusplus */
|
|
39 |
|
|
40 |
/* ------------------------------------------------------------------------- *
|
|
41 |
public data types
|
|
42 |
* ------------------------------------------------------------------------- */
|
|
43 |
|
|
44 |
/** ----------------------------------------------------------------------- **
|
|
45 |
@struct: NW_HED_DomHelper_t
|
|
46 |
|
|
47 |
@synopsis: default
|
|
48 |
|
|
49 |
@scope: public
|
|
50 |
@variables:
|
|
51 |
const NW_HED_EntitySet_t*
|
|
52 |
default
|
|
53 |
|
|
54 |
NW_HED_Context_t* context
|
|
55 |
default
|
|
56 |
|
|
57 |
NW_Bool resolvePlainTextVariablesAndEntities
|
|
58 |
default
|
|
59 |
|
|
60 |
@description: default
|
|
61 |
** ----------------------------------------------------------------------- **/
|
|
62 |
typedef struct NW_HED_DomHelper_s{
|
|
63 |
const NW_HED_EntitySet_t* entitySet;
|
|
64 |
NW_HED_Context_t* context;
|
|
65 |
|
|
66 |
NW_Bool resolvePlainTextVariablesAndEntities;
|
|
67 |
} NW_HED_DomHelper_t;
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
/* ------------------------------------------------------------------------- *
|
|
72 |
public methods
|
|
73 |
* ------------------------------------------------------------------------- */
|
|
74 |
|
|
75 |
/** ----------------------------------------------------------------------- **
|
|
76 |
@function: NW_HED_DomHelper_ResolveEntities
|
|
77 |
|
|
78 |
@synopsis: default
|
|
79 |
|
|
80 |
@scope: public
|
|
81 |
|
|
82 |
@parameters:
|
|
83 |
[in] const NW_HED_EntitySet_t* entitySet
|
|
84 |
default
|
|
85 |
|
|
86 |
[in] const NW_Ucs2* origText
|
|
87 |
default
|
|
88 |
|
|
89 |
[out] NW_String_t* destString
|
|
90 |
default
|
|
91 |
|
|
92 |
@description: default
|
|
93 |
|
|
94 |
@returns: TBrowserStatusCode
|
|
95 |
default
|
|
96 |
|
|
97 |
[default]
|
|
98 |
default
|
|
99 |
|
|
100 |
** ----------------------------------------------------------------------- **/
|
|
101 |
TBrowserStatusCode NW_HED_DomHelper_ResolveEntities (const NW_HED_EntitySet_t* entitySet,
|
|
102 |
const NW_Ucs2* origText,
|
|
103 |
NW_String_t* destString);
|
|
104 |
|
|
105 |
|
|
106 |
/** ----------------------------------------------------------------------- **
|
|
107 |
@function: NW_HED_DomHelper_GetAttributeValue
|
|
108 |
|
|
109 |
@synopsis: default
|
|
110 |
|
|
111 |
@scope: public
|
|
112 |
|
|
113 |
@parameters:
|
|
114 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
115 |
default
|
|
116 |
|
|
117 |
[in] const NW_DOM_Node_t* element
|
|
118 |
default
|
|
119 |
|
|
120 |
[in] NW_Uint16 attribute
|
|
121 |
default
|
|
122 |
|
|
123 |
[out] NW_String_t* value
|
|
124 |
default
|
|
125 |
|
|
126 |
@description: default
|
|
127 |
|
|
128 |
@returns: TBrowserStatusCode
|
|
129 |
default
|
|
130 |
|
|
131 |
[default]
|
|
132 |
default
|
|
133 |
|
|
134 |
** ----------------------------------------------------------------------- **/
|
|
135 |
TBrowserStatusCode NW_HED_DomHelper_GetAttributeValue (const NW_HED_DomHelper_t* domHelper,
|
|
136 |
const NW_DOM_Node_t* element,
|
|
137 |
NW_Uint16 attribute,
|
|
138 |
NW_String_t* value);
|
|
139 |
|
|
140 |
TBrowserStatusCode NW_HED_DomHelper_GetHTMLAttributeValue (const NW_HED_DomHelper_t* domHelper,
|
|
141 |
const NW_DOM_Node_t* element,
|
|
142 |
NW_Uint16 attribute,
|
|
143 |
NW_String_t* value);
|
|
144 |
|
|
145 |
/** ----------------------------------------------------------------------- **
|
|
146 |
@function: NW_HED_DomHelper_GetText
|
|
147 |
|
|
148 |
@synopsis: default
|
|
149 |
|
|
150 |
@scope: public
|
|
151 |
|
|
152 |
@parameters:
|
|
153 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
154 |
default
|
|
155 |
|
|
156 |
[in] const NW_DOM_Node_t* element
|
|
157 |
default
|
|
158 |
|
|
159 |
[in] NW_Bool forceUcs2Copy
|
|
160 |
default
|
|
161 |
|
|
162 |
[out] NW_String_t* value
|
|
163 |
default
|
|
164 |
|
|
165 |
[out] NW_Uint32* valueEncoding
|
|
166 |
default
|
|
167 |
|
|
168 |
@description: default
|
|
169 |
|
|
170 |
@returns: TBrowserStatusCode
|
|
171 |
default
|
|
172 |
|
|
173 |
[default]
|
|
174 |
default
|
|
175 |
|
|
176 |
** ----------------------------------------------------------------------- **/
|
|
177 |
TBrowserStatusCode NW_HED_DomHelper_GetText (const NW_HED_DomHelper_t* domHelper,
|
|
178 |
const NW_DOM_Node_t* element,
|
|
179 |
NW_Bool forceUcs2Copy,
|
|
180 |
NW_String_t* value,
|
|
181 |
NW_Uint32* valueEncoding);
|
|
182 |
|
|
183 |
|
|
184 |
/** ----------------------------------------------------------------------- **
|
|
185 |
@function: NW_HED_DomHelper_GetChildText
|
|
186 |
|
|
187 |
@synopsis: default
|
|
188 |
|
|
189 |
@scope: public
|
|
190 |
|
|
191 |
@parameters:
|
|
192 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
193 |
default
|
|
194 |
|
|
195 |
[in] const NW_DOM_Node_t* element
|
|
196 |
default
|
|
197 |
|
|
198 |
[out] NW_String_t* value
|
|
199 |
default
|
|
200 |
|
|
201 |
@description: default
|
|
202 |
|
|
203 |
@returns: TBrowserStatusCode
|
|
204 |
default
|
|
205 |
|
|
206 |
[default]
|
|
207 |
default
|
|
208 |
|
|
209 |
** ----------------------------------------------------------------------- **/
|
|
210 |
TBrowserStatusCode NW_HED_DomHelper_GetChildText (const NW_HED_DomHelper_t* domHelper,
|
|
211 |
const NW_DOM_Node_t* element,
|
|
212 |
NW_String_t* value);
|
|
213 |
|
|
214 |
/** ----------------------------------------------------------------------- **
|
|
215 |
@function: NW_HED_DomHelper_AttributeEquals
|
|
216 |
|
|
217 |
@synopsis: default
|
|
218 |
|
|
219 |
@scope: public
|
|
220 |
|
|
221 |
@parameters:
|
|
222 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
223 |
default
|
|
224 |
|
|
225 |
[in] const NW_DOM_Node_t* element
|
|
226 |
default
|
|
227 |
|
|
228 |
[in] NW_Uint16 attribute
|
|
229 |
default
|
|
230 |
|
|
231 |
[in] const NW_String_t* value
|
|
232 |
default
|
|
233 |
|
|
234 |
@description: default
|
|
235 |
|
|
236 |
@returns: NW_Bool
|
|
237 |
default
|
|
238 |
|
|
239 |
** ----------------------------------------------------------------------- **/
|
|
240 |
NW_Bool NW_HED_DomHelper_AttributeEquals (const NW_HED_DomHelper_t* domHelper,
|
|
241 |
const NW_DOM_Node_t* element,
|
|
242 |
NW_Uint16 attribute,
|
|
243 |
const NW_String_t* value);
|
|
244 |
|
|
245 |
|
|
246 |
/** ----------------------------------------------------------------------- **
|
|
247 |
@function: NW_HED_DomHelper_IsMatch
|
|
248 |
|
|
249 |
@synopsis: default
|
|
250 |
|
|
251 |
@scope: public
|
|
252 |
|
|
253 |
@parameters:
|
|
254 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
255 |
default
|
|
256 |
|
|
257 |
[in] const NW_DOM_Node_t* element
|
|
258 |
default
|
|
259 |
|
|
260 |
[in] NW_Uint16 elementType
|
|
261 |
default
|
|
262 |
|
|
263 |
[in] NW_Uint16 attribute
|
|
264 |
default
|
|
265 |
|
|
266 |
[in] const attributeMatchString
|
|
267 |
default
|
|
268 |
|
|
269 |
@description: default
|
|
270 |
|
|
271 |
@returns: NW_Bool
|
|
272 |
default
|
|
273 |
|
|
274 |
[default]
|
|
275 |
default
|
|
276 |
|
|
277 |
** ----------------------------------------------------------------------- **/
|
|
278 |
NW_Bool NW_HED_DomHelper_IsMatch (const NW_HED_DomHelper_t* domHelper,
|
|
279 |
NW_DOM_Node_t* element,
|
|
280 |
NW_Uint16 elementType,
|
|
281 |
NW_Uint16 attribute,
|
|
282 |
const NW_String_t* attributeMatchString);
|
|
283 |
|
|
284 |
|
|
285 |
/** ----------------------------------------------------------------------- **
|
|
286 |
@function: NW_HED_DomHelper_FindElement
|
|
287 |
|
|
288 |
@synopsis: default
|
|
289 |
|
|
290 |
@scope: public
|
|
291 |
|
|
292 |
@parameters:
|
|
293 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
294 |
default
|
|
295 |
|
|
296 |
[in] NW_DOM_Node_t* rootNode
|
|
297 |
default
|
|
298 |
|
|
299 |
[in] NW_Int32 maxSearchDepth
|
|
300 |
default
|
|
301 |
|
|
302 |
[in] NW_Uint16 elementType
|
|
303 |
default
|
|
304 |
|
|
305 |
[in] NW_Uint16 attribute
|
|
306 |
default
|
|
307 |
|
|
308 |
[in] const NW_String_t* attributeMatchString
|
|
309 |
default
|
|
310 |
|
|
311 |
@description: default
|
|
312 |
|
|
313 |
@returns: NW_DOM_Node_t*
|
|
314 |
default
|
|
315 |
|
|
316 |
** ----------------------------------------------------------------------- **/
|
|
317 |
NW_DOM_Node_t* NW_HED_DomHelper_FindElement (const NW_HED_DomHelper_t* domHelper,
|
|
318 |
NW_DOM_Node_t* rootNode,
|
|
319 |
NW_Int32 maxSearchDepth,
|
|
320 |
NW_Uint16 elementType,
|
|
321 |
NW_Uint16 attribute,
|
|
322 |
const NW_String_t* attributeMatchString);
|
|
323 |
|
|
324 |
|
|
325 |
/** ----------------------------------------------------------------------- **
|
|
326 |
@function: NW_HED_DomHelper_GetEncoding
|
|
327 |
|
|
328 |
@synopsis: default
|
|
329 |
|
|
330 |
@scope: public
|
|
331 |
|
|
332 |
@parameters:
|
|
333 |
[in] const NW_DOM_Node_t* element
|
|
334 |
default
|
|
335 |
|
|
336 |
@description: default
|
|
337 |
|
|
338 |
@returns: NW_Uint32
|
|
339 |
default
|
|
340 |
|
|
341 |
** ----------------------------------------------------------------------- **/
|
|
342 |
NW_Uint32 NW_HED_DomHelper_GetEncoding (const NW_DOM_Node_t* element);
|
|
343 |
|
|
344 |
|
|
345 |
/** ----------------------------------------------------------------------- **
|
|
346 |
@function: NW_HED_DomHelper_GetDictionary
|
|
347 |
|
|
348 |
@synopsis: default
|
|
349 |
|
|
350 |
@scope: public
|
|
351 |
|
|
352 |
@parameters:
|
|
353 |
[in] const NW_DOM_Node_t* element
|
|
354 |
default
|
|
355 |
|
|
356 |
@description: default
|
|
357 |
|
|
358 |
@returns: NW_WBXML_Dictionary_t*
|
|
359 |
default
|
|
360 |
|
|
361 |
** ----------------------------------------------------------------------- **/
|
|
362 |
NW_WBXML_Dictionary_t* NW_HED_DomHelper_GetDictionary (const NW_DOM_Node_t* element);
|
|
363 |
|
|
364 |
|
|
365 |
/** ----------------------------------------------------------------------- **
|
|
366 |
@function: NW_HED_DomHelper_GetAttributeName
|
|
367 |
|
|
368 |
@synopsis: default
|
|
369 |
|
|
370 |
@scope: public
|
|
371 |
|
|
372 |
@parameters:
|
|
373 |
[in] const NW_DOM_Node_t* element
|
|
374 |
default
|
|
375 |
|
|
376 |
[in] NW_Uint16 attribute
|
|
377 |
default
|
|
378 |
|
|
379 |
[out] NW_String_t* name
|
|
380 |
default
|
|
381 |
|
|
382 |
@description: default
|
|
383 |
|
|
384 |
@returns: TBrowserStatusCode
|
|
385 |
default
|
|
386 |
|
|
387 |
[default]
|
|
388 |
default
|
|
389 |
|
|
390 |
** ----------------------------------------------------------------------- **/
|
|
391 |
TBrowserStatusCode NW_HED_DomHelper_GetAttributeName (const NW_DOM_Node_t* element,
|
|
392 |
NW_Uint16 attribute,
|
|
393 |
NW_String_t* name);
|
|
394 |
|
|
395 |
/** ----------------------------------------------------------------------- **
|
|
396 |
@function: NW_HED_DomHelper_GetElementToken
|
|
397 |
|
|
398 |
@synopsis: default
|
|
399 |
|
|
400 |
@scope: public
|
|
401 |
|
|
402 |
@parameters:
|
|
403 |
[in] const NW_DOM_Node_t* element
|
|
404 |
default
|
|
405 |
|
|
406 |
@description: default
|
|
407 |
|
|
408 |
@returns: NW_Uint16
|
|
409 |
default
|
|
410 |
|
|
411 |
** ----------------------------------------------------------------------- **/
|
|
412 |
NW_Uint16 NW_HED_DomHelper_GetElementToken (const NW_DOM_Node_t* element);
|
|
413 |
|
|
414 |
|
|
415 |
/** ----------------------------------------------------------------------- **
|
|
416 |
@function: NW_HED_DomHelper_GetElementName
|
|
417 |
|
|
418 |
@synopsis: default
|
|
419 |
|
|
420 |
@scope: public
|
|
421 |
|
|
422 |
@parameters:
|
|
423 |
[in] const NW_DOM_Node_t* element
|
|
424 |
default
|
|
425 |
|
|
426 |
[out] NW_String_t* name
|
|
427 |
default
|
|
428 |
|
|
429 |
@description: default
|
|
430 |
|
|
431 |
@returns: TBrowserStatusCode
|
|
432 |
default
|
|
433 |
|
|
434 |
[default]
|
|
435 |
default
|
|
436 |
|
|
437 |
** ----------------------------------------------------------------------- **/
|
|
438 |
TBrowserStatusCode NW_HED_DomHelper_GetElementName (const NW_DOM_Node_t* element,
|
|
439 |
NW_String_t* name);
|
|
440 |
|
|
441 |
/** ----------------------------------------------------------------------- **
|
|
442 |
@function: NW_HED_DomHelper_PrintTree
|
|
443 |
|
|
444 |
@synopsis: default
|
|
445 |
|
|
446 |
@scope: public
|
|
447 |
|
|
448 |
@parameters:
|
|
449 |
[in] const NW_HED_DomHelper_t* domHelper
|
|
450 |
default
|
|
451 |
|
|
452 |
[in] const rootNode
|
|
453 |
const NW_DOM_Node_t* rootNode
|
|
454 |
|
|
455 |
@description: default
|
|
456 |
|
|
457 |
@returns: TBrowserStatusCode
|
|
458 |
default
|
|
459 |
|
|
460 |
[default]
|
|
461 |
default
|
|
462 |
|
|
463 |
** ----------------------------------------------------------------------- **/
|
|
464 |
TBrowserStatusCode NW_HED_DomHelper_PrintTree (const NW_HED_DomHelper_t* domHelper,
|
|
465 |
const NW_DOM_Node_t* rootNode);
|
|
466 |
|
|
467 |
|
|
468 |
TBrowserStatusCode NW_HED_DomHelper_PrintNode (const NW_HED_DomHelper_t* domHelper,
|
|
469 |
const NW_DOM_Node_t* domNode);
|
|
470 |
/** ----------------------------------------------------------------------- **
|
|
471 |
@function: NW_HED_DomHelper_CatString
|
|
472 |
|
|
473 |
@synopsis: default
|
|
474 |
|
|
475 |
@scope: public
|
|
476 |
|
|
477 |
@parameters:
|
|
478 |
[in-out] NW_String_t* destString
|
|
479 |
default
|
|
480 |
|
|
481 |
[in] const NW_String_t* srcString
|
|
482 |
default
|
|
483 |
|
|
484 |
[in] NW_Uint32 srcEncoding
|
|
485 |
default
|
|
486 |
|
|
487 |
@description: default
|
|
488 |
|
|
489 |
@returns: TBrowserStatusCode
|
|
490 |
default
|
|
491 |
|
|
492 |
[default]
|
|
493 |
default
|
|
494 |
|
|
495 |
** ----------------------------------------------------------------------- **/
|
|
496 |
TBrowserStatusCode NW_HED_DomHelper_CatString (NW_String_t* destString,
|
|
497 |
const NW_String_t* srcString,
|
|
498 |
NW_Uint32 srcEncoding);
|
|
499 |
|
|
500 |
/** ----------------------------------------------------------------------- **
|
|
501 |
@function: NW_HED_DomHelper_CatUcs2String
|
|
502 |
|
|
503 |
@synopsis: default
|
|
504 |
|
|
505 |
@scope: public
|
|
506 |
|
|
507 |
@parameters:
|
|
508 |
[in-out] NW_String_t* destString
|
|
509 |
default
|
|
510 |
|
|
511 |
[in] const NW_Ucs2* srcString
|
|
512 |
default
|
|
513 |
|
|
514 |
@description: default
|
|
515 |
|
|
516 |
@returns: TBrowserStatusCode
|
|
517 |
default
|
|
518 |
|
|
519 |
[default]
|
|
520 |
default
|
|
521 |
|
|
522 |
** ----------------------------------------------------------------------- **/
|
|
523 |
TBrowserStatusCode NW_HED_DomHelper_CatUcs2String (NW_String_t* destString,
|
|
524 |
const NW_Ucs2* srcString);
|
|
525 |
|
|
526 |
/** ----------------------------------------------------------------------- **
|
|
527 |
@function: NW_HED_DomHelper_HasAttribute
|
|
528 |
|
|
529 |
@synopsis: default
|
|
530 |
|
|
531 |
@scope: public
|
|
532 |
|
|
533 |
@parameters:
|
|
534 |
|
|
535 |
[in] const NW_DOM_Node_t* element
|
|
536 |
default
|
|
537 |
|
|
538 |
[in] NW_Uint16 attribute
|
|
539 |
default
|
|
540 |
|
|
541 |
@description: default
|
|
542 |
|
|
543 |
@returns: TBrowserStatusCode
|
|
544 |
KBrsrSuccess- Attribute is found.
|
|
545 |
KBrsrNotFound - Attribute is not found.
|
|
546 |
KBrsrDomNodeTypeErr - not a DOM node
|
|
547 |
|
|
548 |
[default]
|
|
549 |
default
|
|
550 |
** ----------------------------------------------------------------------- **/
|
|
551 |
|
|
552 |
TBrowserStatusCode NW_HED_DomHelper_HasAttribute(const NW_DOM_Node_t* element,
|
|
553 |
NW_Uint16 attributeToken);
|
|
554 |
|
|
555 |
#ifdef __cplusplus
|
|
556 |
} // extern "C" {
|
|
557 |
#endif /* __cplusplus */
|
|
558 |
|
|
559 |
#endif /* NW_HED_DOM_HELPER_H */
|