OSDN Git Service

* rename chxj_node_exchange --> chxj_node_convert
[modchxj/mod_chxj.git] / src / chxj_node_convert.c
1 /*
2  * Copyright (C) 2005-2008 QSDN,Inc. All rights reserved.
3  * Copyright (C) 2005 Atsushi Konno All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #include "mod_chxj.h"
18
19 tag_handlers chxj_tag_handlers[] = {
20   {
21     .type    = CHXJ_SPEC_UNKNOWN,
22     .handler = NULL,
23   },
24   {
25     .type    = CHXJ_SPEC_Chtml_1_0,
26     .handler = chtml10_handler,
27   },
28   {
29     .type    = CHXJ_SPEC_Chtml_2_0,
30     .handler = chtml20_handler,
31   },
32   {
33     .type    = CHXJ_SPEC_Chtml_3_0,
34     .handler = chtml30_handler,
35   },
36   {
37     .type    = CHXJ_SPEC_Chtml_4_0,
38     .handler = chtml30_handler,
39   },
40   {
41     .type    = CHXJ_SPEC_Chtml_5_0,
42     .handler = chtml30_handler,
43   },
44   {
45     .type    = CHXJ_SPEC_Chtml_6_0,
46     .handler = chtml30_handler,
47   },
48   {
49     .type    = CHXJ_SPEC_Chtml_7_0,
50     .handler = chtml30_handler,
51   },
52   {
53     .type    = CHXJ_SPEC_XHtml_Mobile_1_0,
54     .handler = xhtml_handler,
55   },
56   {
57     .type    = CHXJ_SPEC_Hdml,
58     .handler = hdml_handler,
59   },
60   {
61     .type    = CHXJ_SPEC_Jhtml,
62     .handler = jhtml_handler,
63   },
64   {
65     .type    = CHXJ_SPEC_Jxhtml,
66     .handler = jhtml_handler,
67   },
68   {
69     .type    = CHXJ_SPEC_HTML,
70     .handler = NULL,
71   },
72 };
73
74
75 /**
76  * It is main processing of conversion from CHTML to XXML. 
77  *
78  * @param spec    [i]   
79  * @param r       [i]   
80  * @param pdoc    [i/o] The pointer to the XXML structure is specified. 
81  * @param doc     [i/o] The pointer to the XXML structure is specified. 
82  * @param node    [i]   The pointer to a current node is specified. 
83  * @param indent  [i]   The depth of the node processing it now is specified. 
84  *
85  * @return The character string after it converts it is returned. 
86  */
87 char *
88 chxj_node_convert(
89   device_table *spec,
90   request_rec  *r,
91   void         *pdoc, 
92   Doc          *doc, 
93   Node         *node, 
94   int          indent
95 )
96 {
97   Node         *child;
98   tag_handler  *handlers;
99
100
101   handlers = chxj_tag_handlers[spec->html_spec_type].handler;
102
103   /*--------------------------------------------------------------------------*/
104   /* It is the main loop of the conversion processing.                        */
105   /*--------------------------------------------------------------------------*/
106   for (child = qs_get_child_node(doc,node);
107        child;
108        child = qs_get_next_node(doc,child)) {
109     char *name = qs_get_node_name(doc,child);
110     switch(*name) {
111     case 'h':
112     case 'H':
113       /*----------------------------------------------------------------------*/
114       /* <HTML>                                                               */
115       /*----------------------------------------------------------------------*/
116       if (strcasecmp(name, "html") == 0) {
117         if (handlers[tagHTML].start_tag_handler) 
118           handlers[tagHTML].start_tag_handler(pdoc, child);
119
120         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
121
122         if (handlers[tagHTML].end_tag_handler)
123           handlers[tagHTML].end_tag_handler(pdoc, child);
124       }
125       /*----------------------------------------------------------------------*/
126       /* <HEAD>                                                               */
127       /*----------------------------------------------------------------------*/
128       else 
129       if (strcasecmp(name, "head") == 0) {
130         if (handlers[tagHEAD].start_tag_handler) 
131           handlers[tagHEAD].start_tag_handler(pdoc, child);
132
133         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
134
135         if (handlers[tagHEAD].end_tag_handler)
136           handlers[tagHEAD].end_tag_handler(pdoc, child);
137       }
138       /*----------------------------------------------------------------------*/
139       /* <HR>                                                                 */
140       /*----------------------------------------------------------------------*/
141       else 
142       if (strcasecmp(name, "hr") == 0) {
143         if (handlers[tagHR].start_tag_handler) 
144           handlers[tagHR].start_tag_handler(pdoc, child);
145
146         if (handlers[tagHR].end_tag_handler)
147           handlers[tagHR].end_tag_handler(pdoc, child);
148       }
149       /*----------------------------------------------------------------------*/
150       /* <H1>                                                                 */
151       /*----------------------------------------------------------------------*/
152       else
153       if (strcasecmp(name, "h1") == 0) {
154         if (handlers[tagH1].start_tag_handler) 
155           handlers[tagH1].start_tag_handler(pdoc, child);
156
157         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
158
159         if (handlers[tagH1].end_tag_handler)
160           handlers[tagH1].end_tag_handler(pdoc, child);
161       }
162       /*----------------------------------------------------------------------*/
163       /* <H2>                                                                 */
164       /*----------------------------------------------------------------------*/
165       else
166       if (strcasecmp(name, "h2") == 0) {
167         if (handlers[tagH2].start_tag_handler) 
168           handlers[tagH2].start_tag_handler(pdoc, child);
169
170         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
171
172         if (handlers[tagH2].end_tag_handler)
173           handlers[tagH2].end_tag_handler(pdoc, child);
174       }
175       /*----------------------------------------------------------------------*/
176       /* <H3>                                                                 */
177       /*----------------------------------------------------------------------*/
178       else
179       if (strcasecmp(name, "h3") == 0) {
180         if (handlers[tagH3].start_tag_handler) 
181           handlers[tagH3].start_tag_handler(pdoc, child);
182
183         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
184
185         if (handlers[tagH3].end_tag_handler)
186           handlers[tagH3].end_tag_handler(pdoc, child);
187       }
188       /*----------------------------------------------------------------------*/
189       /* <H4>                                                                 */
190       /*----------------------------------------------------------------------*/
191       else
192       if (strcasecmp(name, "h4") == 0) {
193         if (handlers[tagH4].start_tag_handler) 
194           handlers[tagH4].start_tag_handler(pdoc, child);
195
196         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
197
198         if (handlers[tagH4].end_tag_handler)
199           handlers[tagH4].end_tag_handler(pdoc, child);
200       }
201       /*----------------------------------------------------------------------*/
202       /* <H5>                                                                 */
203       /*----------------------------------------------------------------------*/
204       else
205       if (strcasecmp(name, "h5") == 0) {
206         if (handlers[tagH5].start_tag_handler) 
207           handlers[tagH5].start_tag_handler(pdoc, child);
208
209         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
210
211         if (handlers[tagH5].end_tag_handler)
212           handlers[tagH5].end_tag_handler(pdoc, child);
213       }
214       /*----------------------------------------------------------------------*/
215       /* <H6>                                                                 */
216       /*----------------------------------------------------------------------*/
217       else
218       if (strcasecmp(name, "h6") == 0) {
219         if (handlers[tagH6].start_tag_handler) 
220           handlers[tagH6].start_tag_handler(pdoc, child);
221
222         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
223
224         if (handlers[tagH6].end_tag_handler)
225           handlers[tagH6].end_tag_handler(pdoc, child);
226       }
227       else {
228         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
229       }
230       break;
231
232
233     case 'p':
234     case 'P':
235       /*----------------------------------------------------------------------*/
236       /* <P>                                                                  */
237       /*----------------------------------------------------------------------*/
238       if (strcasecmp(name, "p") == 0) {
239         if (handlers[tagP].start_tag_handler) 
240           handlers[tagP].start_tag_handler(pdoc, child);
241
242         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
243
244         if (handlers[tagP].end_tag_handler)
245           handlers[tagP].end_tag_handler(pdoc, child);
246       }
247       /*----------------------------------------------------------------------*/
248       /* <PRE>                                                                */
249       /*----------------------------------------------------------------------*/
250       else if (strcasecmp(name, "pre") == 0) {
251         if (handlers[tagPRE].start_tag_handler) 
252           handlers[tagPRE].start_tag_handler(pdoc, child);
253
254         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
255
256         if (handlers[tagPRE].end_tag_handler)
257           handlers[tagPRE].end_tag_handler(pdoc, child);
258       }
259       /*----------------------------------------------------------------------*/
260       /* <PLAINTEXT>                                                          */
261       /*----------------------------------------------------------------------*/
262       else if (strcasecmp(name, "plaintext") == 0) {
263         if (handlers[tagPLAINTEXT].start_tag_handler) 
264           handlers[tagPLAINTEXT].start_tag_handler(pdoc, child);
265
266         if (handlers[tagPLAINTEXT].end_tag_handler)
267           handlers[tagPLAINTEXT].end_tag_handler(pdoc, child);
268       }
269       else {
270         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
271       }
272       break;
273
274     case 'n':
275     case 'N':
276       /*----------------------------------------------------------------------*/
277       /* <NOBR>                                                               */
278       /*----------------------------------------------------------------------*/
279       if (strcasecmp(name, "nobr") == 0) {
280         if (handlers[tagNOBR].start_tag_handler) 
281           handlers[tagNOBR].start_tag_handler(pdoc, child);
282
283         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
284
285         if (handlers[tagNOBR].end_tag_handler)
286           handlers[tagNOBR].end_tag_handler(pdoc, child);
287       }
288       else {
289         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
290       }
291       break;
292
293     case 'u':
294     case 'U':
295       /*----------------------------------------------------------------------*/
296       /* <UL>                                                                 */
297       /*----------------------------------------------------------------------*/
298       if (strcasecmp(name, "ul") == 0) {
299         if (handlers[tagUL].start_tag_handler) 
300           handlers[tagUL].start_tag_handler(pdoc, child);
301
302         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
303
304         if (handlers[tagUL].end_tag_handler)
305           handlers[tagUL].end_tag_handler(pdoc, child);
306       }
307       else {
308         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
309       }
310       break;
311
312     case 'l':
313     case 'L':
314       /*----------------------------------------------------------------------*/
315       /* <LI>                                                                 */
316       /*----------------------------------------------------------------------*/
317       if (strcasecmp(name, "li") == 0) {
318         if (handlers[tagLI].start_tag_handler) 
319           handlers[tagLI].start_tag_handler(pdoc, child);
320
321         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
322
323         if (handlers[tagLI].end_tag_handler)
324           handlers[tagLI].end_tag_handler(pdoc, child);
325       }
326       else
327       /*----------------------------------------------------------------------*/
328       /* <LEGEND>                                                             */
329       /*----------------------------------------------------------------------*/
330       if (strcasecmp(name, "legend") == 0) {
331         if (handlers[tagLEGEND].start_tag_handler) 
332           handlers[tagLEGEND].start_tag_handler(pdoc, child);
333
334         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
335
336         if (handlers[tagLEGEND].end_tag_handler)
337           handlers[tagLEGEND].end_tag_handler(pdoc, child);
338       }
339       else
340       /*----------------------------------------------------------------------*/
341       /* <LABEL>                                                              */
342       /*----------------------------------------------------------------------*/
343       if (strcasecmp(name, "label") == 0) {
344         if (handlers[tagLABEL].start_tag_handler) 
345           handlers[tagLABEL].start_tag_handler(pdoc, child);
346
347         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
348
349         if (handlers[tagLABEL].end_tag_handler)
350           handlers[tagLABEL].end_tag_handler(pdoc, child);
351       }
352       else {
353         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
354       }
355       
356       break;
357
358     case 'o':
359     case 'O':
360       /*----------------------------------------------------------------------*/
361       /* <OL>                                                                 */
362       /*----------------------------------------------------------------------*/
363       if (strcasecmp(name, "ol") == 0) {
364         if (handlers[tagOL].start_tag_handler) 
365           handlers[tagOL].start_tag_handler(pdoc, child);
366
367         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
368
369         if (handlers[tagOL].end_tag_handler)
370           handlers[tagOL].end_tag_handler(pdoc, child);
371       }
372       else
373       /*----------------------------------------------------------------------*/
374       /* <OPTION>                                                             */
375       /*----------------------------------------------------------------------*/
376       if (strcasecmp(name, "option") == 0) {
377         if (handlers[tagOPTION].start_tag_handler) 
378           handlers[tagOPTION].start_tag_handler(pdoc, child);
379
380         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
381
382         if (handlers[tagOPTION].end_tag_handler)
383           handlers[tagOPTION].end_tag_handler(pdoc, child);
384       }
385       else
386       /*----------------------------------------------------------------------*/
387       /* <OBJECT>                                                             */
388       /*----------------------------------------------------------------------*/
389       if (strcasecmp(name, "object") == 0) {
390         /* ignore object block */
391       }
392       else {
393         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
394       }
395
396       break;
397
398     case 'm':
399     case 'M':
400       /*----------------------------------------------------------------------*/
401       /* <META>                                                               */
402       /*----------------------------------------------------------------------*/
403       if (strcasecmp(name, "meta") == 0) {
404         if (handlers[tagMETA].start_tag_handler) 
405           handlers[tagMETA].start_tag_handler(pdoc, child);
406
407         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
408
409         if (handlers[tagMETA].end_tag_handler)
410           handlers[tagMETA].end_tag_handler(pdoc, child);
411       }
412       /*----------------------------------------------------------------------*/
413       /* <MENU>                                                               */
414       /*----------------------------------------------------------------------*/
415       else if (strcasecmp(name, "menu") == 0) {
416         if (handlers[tagMENU].start_tag_handler) 
417           handlers[tagMENU].start_tag_handler(pdoc, child);
418
419         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
420
421         if (handlers[tagMENU].end_tag_handler)
422           handlers[tagMENU].end_tag_handler(pdoc, child);
423       }
424       /*----------------------------------------------------------------------*/
425       /* <MARQUEE>                                                            */
426       /*----------------------------------------------------------------------*/
427       else if (strcasecmp(name, "marquee") == 0) {
428         if (handlers[tagMARQUEE].start_tag_handler) 
429           handlers[tagMARQUEE].start_tag_handler(pdoc, child);
430
431         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
432
433         if (handlers[tagMARQUEE].end_tag_handler)
434           handlers[tagMARQUEE].end_tag_handler(pdoc, child);
435       }
436       else {
437         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
438       }
439       break;
440
441     case 'b':
442     case 'B':
443       /*----------------------------------------------------------------------*/
444       /* <B>                                                                  */
445       /*----------------------------------------------------------------------*/
446       if (strlen(name) == 1) {
447         if (handlers[tagB].start_tag_handler) 
448           handlers[tagB].start_tag_handler(pdoc, child);
449
450         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
451
452         if (handlers[tagB].end_tag_handler)
453           handlers[tagB].end_tag_handler(pdoc, child);
454       }
455       else
456       /*----------------------------------------------------------------------*/
457       /* <BASE>                                                               */
458       /*----------------------------------------------------------------------*/
459       if (strcasecmp(name, "base") == 0) {
460         if (handlers[tagBASE].start_tag_handler) 
461           handlers[tagBASE].start_tag_handler(pdoc, child);
462
463         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
464
465         if (handlers[tagBASE].end_tag_handler)
466           handlers[tagBASE].end_tag_handler(pdoc, child);
467       }
468       /*----------------------------------------------------------------------*/
469       /* <BODY>                                                               */
470       /*----------------------------------------------------------------------*/
471       else
472       if (strcasecmp(name, "body") == 0) {
473         if (handlers[tagBODY].start_tag_handler) 
474           handlers[tagBODY].start_tag_handler(pdoc, child);
475
476         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
477
478         if (handlers[tagBODY].end_tag_handler)
479           handlers[tagBODY].end_tag_handler(pdoc, child);
480       }
481       /*----------------------------------------------------------------------*/
482       /* <BR>                                                                 */
483       /*----------------------------------------------------------------------*/
484       else if (strcasecmp(name, "br") == 0) {
485         if (handlers[tagBR].start_tag_handler) 
486           handlers[tagBR].start_tag_handler(pdoc, child);
487
488         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
489
490         if (handlers[tagBR].end_tag_handler)
491           handlers[tagBR].end_tag_handler(pdoc, child);
492       }
493       /*----------------------------------------------------------------------*/
494       /* <BLOCKQUOTE>                                                         */
495       /*----------------------------------------------------------------------*/
496       else if (strcasecmp(name, "blockquote") == 0) {
497         if (handlers[tagBLOCKQUOTE].start_tag_handler) 
498           handlers[tagBLOCKQUOTE].start_tag_handler(pdoc, child);
499
500         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
501
502         if (handlers[tagBLOCKQUOTE].end_tag_handler)
503           handlers[tagBLOCKQUOTE].end_tag_handler(pdoc, child);
504       }
505       /*----------------------------------------------------------------------*/
506       /* <BLINK>                                                              */
507       /*----------------------------------------------------------------------*/
508       else if (strcasecmp(name, "blink") == 0) {
509         if (handlers[tagBLINK].start_tag_handler) 
510           handlers[tagBLINK].start_tag_handler(pdoc, child);
511
512         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
513
514         if (handlers[tagBLINK].end_tag_handler)
515           handlers[tagBLINK].end_tag_handler(pdoc, child);
516       }
517       else {
518         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
519       }
520       break;
521
522     case 'a':
523     case 'A':
524       /*----------------------------------------------------------------------*/
525       /* <A>                                                                  */
526       /*----------------------------------------------------------------------*/
527       if (strcasecmp(name, "a") == 0) {
528         if (handlers[tagA].start_tag_handler) 
529           handlers[tagA].start_tag_handler(pdoc, child);
530
531         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
532
533         if (handlers[tagA].end_tag_handler)
534           handlers[tagA].end_tag_handler(pdoc, child);
535       }
536       else {
537         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
538       }
539       break;
540
541     case 'f':
542     case 'F':
543       /*----------------------------------------------------------------------*/
544       /* <FONT>                                                               */
545       /*----------------------------------------------------------------------*/
546       if (strcasecmp(name, "font") == 0) {
547         if (handlers[tagFONT].start_tag_handler) 
548           handlers[tagFONT].start_tag_handler(pdoc, child);
549
550         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
551
552         if (handlers[tagFONT].end_tag_handler)
553           handlers[tagFONT].end_tag_handler(pdoc, child);
554       }
555       /*----------------------------------------------------------------------*/
556       /* <FORM>                                                               */
557       /*----------------------------------------------------------------------*/
558       else
559       if (strcasecmp(name, "form") == 0) {
560         if (handlers[tagFORM].start_tag_handler) 
561           handlers[tagFORM].start_tag_handler(pdoc, child);
562
563         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
564
565         if (handlers[tagFORM].end_tag_handler)
566           handlers[tagFORM].end_tag_handler(pdoc, child);
567       }
568       /*----------------------------------------------------------------------*/
569       /* <FIELDSET>                                                           */
570       /*----------------------------------------------------------------------*/
571       else
572       if (strcasecmp(name, "fieldset") == 0) {
573         if (handlers[tagFIELDSET].start_tag_handler) 
574           handlers[tagFIELDSET].start_tag_handler(pdoc, child);
575
576         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
577
578         if (handlers[tagFIELDSET].end_tag_handler)
579           handlers[tagFIELDSET].end_tag_handler(pdoc, child);
580       }
581       else {
582         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
583       }
584       break;
585
586     case 'i':
587     case 'I':
588       /*----------------------------------------------------------------------*/
589       /* <INPUT>                                                              */
590       /*----------------------------------------------------------------------*/
591       if (strcasecmp(name, "input") == 0) {
592         if (handlers[tagINPUT].start_tag_handler) 
593           handlers[tagINPUT].start_tag_handler(pdoc, child);
594
595         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
596
597         if (handlers[tagINPUT].end_tag_handler)
598           handlers[tagINPUT].end_tag_handler(pdoc, child);
599       }
600       /*----------------------------------------------------------------------*/
601       /* <IMG>                                                                */
602       /*----------------------------------------------------------------------*/
603       else
604       if (strcasecmp(name, "img") == 0) {
605         if (handlers[tagIMG].start_tag_handler) 
606           handlers[tagIMG].start_tag_handler(pdoc, child);
607
608         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
609
610         if (handlers[tagIMG].end_tag_handler)
611           handlers[tagIMG].end_tag_handler(pdoc, child);
612       }
613       else {
614         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
615       }
616       break;
617
618     case 's':
619     case 'S':
620       /*----------------------------------------------------------------------*/
621       /* <SELECT>                                                             */
622       /*----------------------------------------------------------------------*/
623       if (strcasecmp(name, "select") == 0) {
624         if (handlers[tagSELECT].start_tag_handler) 
625           handlers[tagSELECT].start_tag_handler(pdoc, child);
626
627         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
628
629         if (handlers[tagSELECT].end_tag_handler)
630           handlers[tagSELECT].end_tag_handler(pdoc, child);
631       }
632       /*----------------------------------------------------------------------*/
633       /* <STYLE>                                                              */
634       /*----------------------------------------------------------------------*/
635       else
636       if (strcasecmp(name, "style") == 0) {
637         if (handlers[tagSTYLE].start_tag_handler) 
638           handlers[tagSTYLE].start_tag_handler(pdoc, child);
639 #if 0
640         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
641 #endif
642
643         if (handlers[tagSTYLE].end_tag_handler)
644           handlers[tagSTYLE].end_tag_handler(pdoc, child);
645       }
646       /*----------------------------------------------------------------------*/
647       /* <SPAN>                                                               */
648       /*----------------------------------------------------------------------*/
649       else
650       if (strcasecmp(name, "span") == 0) {
651         if (handlers[tagSPAN].start_tag_handler) 
652           handlers[tagSPAN].start_tag_handler(pdoc, child);
653
654         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
655
656         if (handlers[tagSPAN].end_tag_handler)
657           handlers[tagSPAN].end_tag_handler(pdoc, child);
658       }
659       /*----------------------------------------------------------------------*/
660       /* <SMALL>                                                              */
661       /*----------------------------------------------------------------------*/
662       else
663       if (strcasecmp(name, "small") == 0) {
664         if (handlers[tagSMALL].start_tag_handler) 
665           handlers[tagSMALL].start_tag_handler(pdoc, child);
666
667         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
668
669         if (handlers[tagSMALL].end_tag_handler)
670           handlers[tagSMALL].end_tag_handler(pdoc, child);
671       }
672       /*----------------------------------------------------------------------*/
673       /* <SCRIPT>                                                             */
674       /*----------------------------------------------------------------------*/
675       else 
676       if (strcasecmp(name, "script") == 0) {
677         /* ignore script block */
678       }
679       else {
680         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
681       }
682       break;
683   
684     case 'd':
685     case 'D':
686       /*----------------------------------------------------------------------*/
687       /* <DIV>                                                                */
688       /*----------------------------------------------------------------------*/
689       if (strcasecmp(name, "div") == 0) {
690         if (handlers[tagDIV].start_tag_handler) 
691           handlers[tagDIV].start_tag_handler(pdoc, child);
692
693         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
694
695         if (handlers[tagDIV].end_tag_handler)
696           handlers[tagDIV].end_tag_handler(pdoc, child);
697       }
698       /*----------------------------------------------------------------------*/
699       /* <DIR>                                                                */
700       /*----------------------------------------------------------------------*/
701       else if (strcasecmp(name, "dir") == 0) {
702         if (handlers[tagDIR].start_tag_handler) 
703           handlers[tagDIR].start_tag_handler(pdoc, child);
704
705         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
706
707         if (handlers[tagDIR].end_tag_handler)
708           handlers[tagDIR].end_tag_handler(pdoc, child);
709       }
710       /*----------------------------------------------------------------------*/
711       /* <DL>                                                                 */
712       /*----------------------------------------------------------------------*/
713       else if (strcasecmp(name, "dl") == 0) {
714         if (handlers[tagDL].start_tag_handler) 
715           handlers[tagDL].start_tag_handler(pdoc, child);
716
717         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
718
719         if (handlers[tagDL].end_tag_handler)
720           handlers[tagDL].end_tag_handler(pdoc, child);
721       }
722       /*----------------------------------------------------------------------*/
723       /* <DT>                                                                 */
724       /*----------------------------------------------------------------------*/
725       else if (strcasecmp(name, "dt") == 0) {
726         if (handlers[tagDT].start_tag_handler) 
727           handlers[tagDT].start_tag_handler(pdoc, child);
728
729         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
730
731         if (handlers[tagDT].end_tag_handler)
732           handlers[tagDT].end_tag_handler(pdoc, child);
733       }
734       /*----------------------------------------------------------------------*/
735       /* <DD>                                                                 */
736       /*----------------------------------------------------------------------*/
737       else if (strcasecmp(name, "dd") == 0) {
738         if (handlers[tagDD].start_tag_handler) 
739           handlers[tagDD].start_tag_handler(pdoc, child);
740
741         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
742
743         if (handlers[tagDD].end_tag_handler)
744           handlers[tagDD].end_tag_handler(pdoc, child);
745       }
746       else {
747         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
748       }
749       break;
750
751     case 'c':
752     case 'C':
753       /*----------------------------------------------------------------------*/
754       /* <CENTER>                                                             */
755       /*----------------------------------------------------------------------*/
756       if (strcasecmp(name, "center") == 0) {
757         if (handlers[tagCENTER].start_tag_handler) 
758           handlers[tagCENTER].start_tag_handler(pdoc, child);
759
760         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
761
762         if (handlers[tagCENTER].end_tag_handler)
763           handlers[tagCENTER].end_tag_handler(pdoc, child);
764       }
765       /*----------------------------------------------------------------------*/
766       /* <CHXJ:IF>                                                            */
767       /*----------------------------------------------------------------------*/
768       else
769       if (strcasecmp(name, "chxj:if") == 0) {
770         if (chxj_chxjif_is_mine(spec, doc, child)) {
771           char* parse_attr;
772
773           parse_attr = qs_get_parse_attr(doc, child, r);
774
775           if (parse_attr && strcasecmp(parse_attr, "true") == 0) {
776             chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
777           }
778           else {
779             if (handlers[tagCHXJIF].start_tag_handler)
780               handlers[tagCHXJIF].start_tag_handler(pdoc, child);
781           }
782         }
783       }
784       else {
785         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
786       }
787       break;
788
789     case 't':
790     case 'T':
791       /*----------------------------------------------------------------------*/
792       /* <TEXTAREA>                                                           */
793       /*----------------------------------------------------------------------*/
794       if (strcasecmp(name, "textarea") == 0) {
795         if (handlers[tagTEXTAREA].start_tag_handler) 
796           handlers[tagTEXTAREA].start_tag_handler(pdoc, child);
797
798         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
799
800         if (handlers[tagTEXTAREA].end_tag_handler)
801           handlers[tagTEXTAREA].end_tag_handler(pdoc, child);
802       }
803       else
804       /*----------------------------------------------------------------------*/
805       /* <TITLE>                                                              */
806       /*----------------------------------------------------------------------*/
807       if (strcasecmp(name, "title") == 0) {
808         if (handlers[tagTITLE].start_tag_handler) 
809           handlers[tagTITLE].start_tag_handler(pdoc, child);
810
811         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
812
813         if (handlers[tagTITLE].end_tag_handler)
814           handlers[tagTITLE].end_tag_handler(pdoc, child);
815       }
816       /*----------------------------------------------------------------------*/
817       /* <TABLE>                                                              */
818       /*----------------------------------------------------------------------*/
819       else
820       if (strcasecmp(name, "table") == 0) {
821         if (handlers[tagTABLE].start_tag_handler) 
822           handlers[tagTABLE].start_tag_handler(pdoc, child);
823
824         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
825
826         if (handlers[tagTABLE].end_tag_handler)
827           handlers[tagTABLE].end_tag_handler(pdoc, child);
828       }
829       /*----------------------------------------------------------------------*/
830       /* <TBODY>                                                              */
831       /*----------------------------------------------------------------------*/
832       else
833       if (strcasecmp(name, "tbody") == 0) {
834         if (handlers[tagTBODY].start_tag_handler) 
835           handlers[tagTBODY].start_tag_handler(pdoc, child);
836
837         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
838
839         if (handlers[tagTBODY].end_tag_handler)
840           handlers[tagTBODY].end_tag_handler(pdoc, child);
841       }
842       /*----------------------------------------------------------------------*/
843       /* <TH>                                                                 */
844       /*----------------------------------------------------------------------*/
845       else
846       if (strcasecmp(name, "th") == 0) {
847         if (handlers[tagTH].start_tag_handler) 
848           handlers[tagTH].start_tag_handler(pdoc, child);
849
850         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
851
852         if (handlers[tagTH].end_tag_handler)
853           handlers[tagTH].end_tag_handler(pdoc, child);
854       }
855       /*----------------------------------------------------------------------*/
856       /* <TR>                                                                 */
857       /*----------------------------------------------------------------------*/
858       else
859       if (strcasecmp(name, "tr") == 0) {
860         if (handlers[tagTR].start_tag_handler) 
861           handlers[tagTR].start_tag_handler(pdoc, child);
862
863         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
864
865         if (handlers[tagTR].end_tag_handler)
866           handlers[tagTR].end_tag_handler(pdoc, child);
867       }
868       /*----------------------------------------------------------------------*/
869       /* <TD>                                                                 */
870       /*----------------------------------------------------------------------*/
871       else
872       if (strcasecmp(name, "td") == 0) {
873         if (handlers[tagTD].start_tag_handler) 
874           handlers[tagTD].start_tag_handler(pdoc, child);
875
876         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
877
878         if (handlers[tagTD].end_tag_handler)
879           handlers[tagTD].end_tag_handler(pdoc, child);
880       }
881       /*----------------------------------------------------------------------*/
882       /* NORMAL TEXT                                                          */
883       /*----------------------------------------------------------------------*/
884       else
885       if (strcasecmp(name, "text") == 0) {
886         if (handlers[tagTEXT].start_tag_handler)
887           handlers[tagTEXT].start_tag_handler(pdoc, child);
888       }
889       else {
890         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
891       }
892       break;
893
894     default:
895       chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
896     }
897   }
898
899   return NULL;
900 }
901 /*
902  * vim:ts=2 et
903  */