OSDN Git Service

Merge branch 'master' into sandbox
[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 = chtml40_handler,
39   },
40   {
41     .type    = CHXJ_SPEC_Chtml_5_0,
42     .handler = chtml50_handler,
43   },
44   {
45     .type    = CHXJ_SPEC_Chtml_6_0,
46     .handler = chtml50_handler,
47   },
48   {
49     .type    = CHXJ_SPEC_Chtml_7_0,
50     .handler = chtml50_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 = jxhtml_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       /*----------------------------------------------------------------------*/
270       /* <PARAM>                                                              */
271       /*----------------------------------------------------------------------*/
272       else if (strcasecmp(name, "param") == 0) {
273         /* ignore param tag block. */
274       }
275       else {
276         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
277       }
278       break;
279
280     case 'n':
281     case 'N':
282       /*----------------------------------------------------------------------*/
283       /* <NOBR>                                                               */
284       /*----------------------------------------------------------------------*/
285       if (strcasecmp(name, "nobr") == 0) {
286         if (handlers[tagNOBR].start_tag_handler) 
287           handlers[tagNOBR].start_tag_handler(pdoc, child);
288
289         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
290
291         if (handlers[tagNOBR].end_tag_handler)
292           handlers[tagNOBR].end_tag_handler(pdoc, child);
293       }
294       else {
295         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
296       }
297       break;
298
299     case 'u':
300     case 'U':
301       /*----------------------------------------------------------------------*/
302       /* <UL>                                                                 */
303       /*----------------------------------------------------------------------*/
304       if (strcasecmp(name, "ul") == 0) {
305         if (handlers[tagUL].start_tag_handler) 
306           handlers[tagUL].start_tag_handler(pdoc, child);
307
308         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
309
310         if (handlers[tagUL].end_tag_handler)
311           handlers[tagUL].end_tag_handler(pdoc, child);
312       }
313       else {
314         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
315       }
316       break;
317
318     case 'l':
319     case 'L':
320       /*----------------------------------------------------------------------*/
321       /* <LI>                                                                 */
322       /*----------------------------------------------------------------------*/
323       if (strcasecmp(name, "li") == 0) {
324         if (handlers[tagLI].start_tag_handler) 
325           handlers[tagLI].start_tag_handler(pdoc, child);
326
327         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
328
329         if (handlers[tagLI].end_tag_handler)
330           handlers[tagLI].end_tag_handler(pdoc, child);
331       }
332       else
333       /*----------------------------------------------------------------------*/
334       /* <LEGEND>                                                             */
335       /*----------------------------------------------------------------------*/
336       if (strcasecmp(name, "legend") == 0) {
337         if (handlers[tagLEGEND].start_tag_handler) 
338           handlers[tagLEGEND].start_tag_handler(pdoc, child);
339
340         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
341
342         if (handlers[tagLEGEND].end_tag_handler)
343           handlers[tagLEGEND].end_tag_handler(pdoc, child);
344       }
345       else
346       /*----------------------------------------------------------------------*/
347       /* <LABEL>                                                              */
348       /*----------------------------------------------------------------------*/
349       if (strcasecmp(name, "label") == 0) {
350         if (handlers[tagLABEL].start_tag_handler) 
351           handlers[tagLABEL].start_tag_handler(pdoc, child);
352
353         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
354
355         if (handlers[tagLABEL].end_tag_handler)
356           handlers[tagLABEL].end_tag_handler(pdoc, child);
357       }
358       else
359       /*----------------------------------------------------------------------*/
360       /* <LINK>                                                               */
361       /*----------------------------------------------------------------------*/
362       if (strcasecmp(name, "link") == 0) {
363         if (handlers[tagLINK].start_tag_handler) 
364           handlers[tagLINK].start_tag_handler(pdoc, child);
365
366         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
367
368         if (handlers[tagLINK].end_tag_handler)
369           handlers[tagLINK].end_tag_handler(pdoc, child);
370       }
371       else {
372         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
373       }
374       
375       break;
376
377     case 'o':
378     case 'O':
379       /*----------------------------------------------------------------------*/
380       /* <OL>                                                                 */
381       /*----------------------------------------------------------------------*/
382       if (strcasecmp(name, "ol") == 0) {
383         if (handlers[tagOL].start_tag_handler) 
384           handlers[tagOL].start_tag_handler(pdoc, child);
385
386         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
387
388         if (handlers[tagOL].end_tag_handler)
389           handlers[tagOL].end_tag_handler(pdoc, child);
390       }
391       else
392       /*----------------------------------------------------------------------*/
393       /* <OPTION>                                                             */
394       /*----------------------------------------------------------------------*/
395       if (strcasecmp(name, "option") == 0) {
396         if (handlers[tagOPTION].start_tag_handler) 
397           handlers[tagOPTION].start_tag_handler(pdoc, child);
398
399         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
400
401         if (handlers[tagOPTION].end_tag_handler)
402           handlers[tagOPTION].end_tag_handler(pdoc, child);
403       }
404       else
405       /*----------------------------------------------------------------------*/
406       /* <OBJECT>                                                             */
407       /*----------------------------------------------------------------------*/
408       if (strcasecmp(name, "object") == 0) {
409         /* ignore object block */
410       }
411       else {
412         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
413       }
414
415       break;
416
417     case 'm':
418     case 'M':
419       /*----------------------------------------------------------------------*/
420       /* <META>                                                               */
421       /*----------------------------------------------------------------------*/
422       if (strcasecmp(name, "meta") == 0) {
423         if (handlers[tagMETA].start_tag_handler) 
424           handlers[tagMETA].start_tag_handler(pdoc, child);
425
426         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
427
428         if (handlers[tagMETA].end_tag_handler)
429           handlers[tagMETA].end_tag_handler(pdoc, child);
430       }
431       /*----------------------------------------------------------------------*/
432       /* <MENU>                                                               */
433       /*----------------------------------------------------------------------*/
434       else if (strcasecmp(name, "menu") == 0) {
435         if (handlers[tagMENU].start_tag_handler) 
436           handlers[tagMENU].start_tag_handler(pdoc, child);
437
438         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
439
440         if (handlers[tagMENU].end_tag_handler)
441           handlers[tagMENU].end_tag_handler(pdoc, child);
442       }
443       /*----------------------------------------------------------------------*/
444       /* <MARQUEE>                                                            */
445       /*----------------------------------------------------------------------*/
446       else if (strcasecmp(name, "marquee") == 0) {
447         if (handlers[tagMARQUEE].start_tag_handler) 
448           handlers[tagMARQUEE].start_tag_handler(pdoc, child);
449
450         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
451
452         if (handlers[tagMARQUEE].end_tag_handler)
453           handlers[tagMARQUEE].end_tag_handler(pdoc, child);
454       }
455       else {
456         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
457       }
458       break;
459
460     case 'b':
461     case 'B':
462       /*----------------------------------------------------------------------*/
463       /* <B>                                                                  */
464       /*----------------------------------------------------------------------*/
465       if (strlen(name) == 1) {
466         if (handlers[tagB].start_tag_handler) 
467           handlers[tagB].start_tag_handler(pdoc, child);
468
469         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
470
471         if (handlers[tagB].end_tag_handler)
472           handlers[tagB].end_tag_handler(pdoc, child);
473       }
474       else
475       /*----------------------------------------------------------------------*/
476       /* <BASE>                                                               */
477       /*----------------------------------------------------------------------*/
478       if (strcasecmp(name, "base") == 0) {
479         if (handlers[tagBASE].start_tag_handler) 
480           handlers[tagBASE].start_tag_handler(pdoc, child);
481
482         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
483
484         if (handlers[tagBASE].end_tag_handler)
485           handlers[tagBASE].end_tag_handler(pdoc, child);
486       }
487       /*----------------------------------------------------------------------*/
488       /* <BODY>                                                               */
489       /*----------------------------------------------------------------------*/
490       else
491       if (strcasecmp(name, "body") == 0) {
492         if (handlers[tagBODY].start_tag_handler) 
493           handlers[tagBODY].start_tag_handler(pdoc, child);
494
495         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
496
497         if (handlers[tagBODY].end_tag_handler)
498           handlers[tagBODY].end_tag_handler(pdoc, child);
499       }
500       /*----------------------------------------------------------------------*/
501       /* <BR>                                                                 */
502       /*----------------------------------------------------------------------*/
503       else if (strcasecmp(name, "br") == 0) {
504         if (handlers[tagBR].start_tag_handler) 
505           handlers[tagBR].start_tag_handler(pdoc, child);
506
507         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
508
509         if (handlers[tagBR].end_tag_handler)
510           handlers[tagBR].end_tag_handler(pdoc, child);
511       }
512       /*----------------------------------------------------------------------*/
513       /* <BLOCKQUOTE>                                                         */
514       /*----------------------------------------------------------------------*/
515       else if (strcasecmp(name, "blockquote") == 0) {
516         if (handlers[tagBLOCKQUOTE].start_tag_handler) 
517           handlers[tagBLOCKQUOTE].start_tag_handler(pdoc, child);
518
519         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
520
521         if (handlers[tagBLOCKQUOTE].end_tag_handler)
522           handlers[tagBLOCKQUOTE].end_tag_handler(pdoc, child);
523       }
524       /*----------------------------------------------------------------------*/
525       /* <BLINK>                                                              */
526       /*----------------------------------------------------------------------*/
527       else if (strcasecmp(name, "blink") == 0) {
528         if (handlers[tagBLINK].start_tag_handler) 
529           handlers[tagBLINK].start_tag_handler(pdoc, child);
530
531         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
532
533         if (handlers[tagBLINK].end_tag_handler)
534           handlers[tagBLINK].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 'a':
542     case 'A':
543       /*----------------------------------------------------------------------*/
544       /* <A>                                                                  */
545       /*----------------------------------------------------------------------*/
546       if (strcasecmp(name, "a") == 0) {
547         if (handlers[tagA].start_tag_handler) 
548           handlers[tagA].start_tag_handler(pdoc, child);
549
550         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
551
552         if (handlers[tagA].end_tag_handler)
553           handlers[tagA].end_tag_handler(pdoc, child);
554       }
555       else {
556         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
557       }
558       break;
559
560     case 'f':
561     case 'F':
562       /*----------------------------------------------------------------------*/
563       /* <FONT>                                                               */
564       /*----------------------------------------------------------------------*/
565       if (strcasecmp(name, "font") == 0) {
566         if (handlers[tagFONT].start_tag_handler) 
567           handlers[tagFONT].start_tag_handler(pdoc, child);
568
569         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
570
571         if (handlers[tagFONT].end_tag_handler)
572           handlers[tagFONT].end_tag_handler(pdoc, child);
573       }
574       /*----------------------------------------------------------------------*/
575       /* <FORM>                                                               */
576       /*----------------------------------------------------------------------*/
577       else
578       if (strcasecmp(name, "form") == 0) {
579         if (handlers[tagFORM].start_tag_handler) 
580           handlers[tagFORM].start_tag_handler(pdoc, child);
581
582         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
583
584         if (handlers[tagFORM].end_tag_handler)
585           handlers[tagFORM].end_tag_handler(pdoc, child);
586       }
587       /*----------------------------------------------------------------------*/
588       /* <FIELDSET>                                                           */
589       /*----------------------------------------------------------------------*/
590       else
591       if (strcasecmp(name, "fieldset") == 0) {
592         if (handlers[tagFIELDSET].start_tag_handler) 
593           handlers[tagFIELDSET].start_tag_handler(pdoc, child);
594
595         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
596
597         if (handlers[tagFIELDSET].end_tag_handler)
598           handlers[tagFIELDSET].end_tag_handler(pdoc, child);
599       }
600       else {
601         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
602       }
603       break;
604
605     case 'i':
606     case 'I':
607       /*----------------------------------------------------------------------*/
608       /* <INPUT>                                                              */
609       /*----------------------------------------------------------------------*/
610       if (strcasecmp(name, "input") == 0) {
611         if (handlers[tagINPUT].start_tag_handler) 
612           handlers[tagINPUT].start_tag_handler(pdoc, child);
613
614         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
615
616         if (handlers[tagINPUT].end_tag_handler)
617           handlers[tagINPUT].end_tag_handler(pdoc, child);
618       }
619       /*----------------------------------------------------------------------*/
620       /* <IMG>                                                                */
621       /*----------------------------------------------------------------------*/
622       else
623       if (strcasecmp(name, "img") == 0) {
624         if (handlers[tagIMG].start_tag_handler) 
625           handlers[tagIMG].start_tag_handler(pdoc, child);
626
627         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
628
629         if (handlers[tagIMG].end_tag_handler)
630           handlers[tagIMG].end_tag_handler(pdoc, child);
631       }
632       else {
633         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
634       }
635       break;
636
637     case 's':
638     case 'S':
639       /*----------------------------------------------------------------------*/
640       /* <SELECT>                                                             */
641       /*----------------------------------------------------------------------*/
642       if (strcasecmp(name, "select") == 0) {
643         if (handlers[tagSELECT].start_tag_handler) 
644           handlers[tagSELECT].start_tag_handler(pdoc, child);
645
646         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
647
648         if (handlers[tagSELECT].end_tag_handler)
649           handlers[tagSELECT].end_tag_handler(pdoc, child);
650       }
651       /*----------------------------------------------------------------------*/
652       /* <STYLE>                                                              */
653       /*----------------------------------------------------------------------*/
654       else
655       if (strcasecmp(name, "style") == 0) {
656         if (handlers[tagSTYLE].start_tag_handler) 
657           handlers[tagSTYLE].start_tag_handler(pdoc, child);
658 #if 0
659         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
660 #endif
661
662         if (handlers[tagSTYLE].end_tag_handler)
663           handlers[tagSTYLE].end_tag_handler(pdoc, child);
664       }
665       /*----------------------------------------------------------------------*/
666       /* <SPAN>                                                               */
667       /*----------------------------------------------------------------------*/
668       else
669       if (strcasecmp(name, "span") == 0) {
670         if (handlers[tagSPAN].start_tag_handler) 
671           handlers[tagSPAN].start_tag_handler(pdoc, child);
672
673         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
674
675         if (handlers[tagSPAN].end_tag_handler)
676           handlers[tagSPAN].end_tag_handler(pdoc, child);
677       }
678       /*----------------------------------------------------------------------*/
679       /* <SMALL>                                                              */
680       /*----------------------------------------------------------------------*/
681       else
682       if (strcasecmp(name, "small") == 0) {
683         if (handlers[tagSMALL].start_tag_handler) 
684           handlers[tagSMALL].start_tag_handler(pdoc, child);
685
686         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
687
688         if (handlers[tagSMALL].end_tag_handler)
689           handlers[tagSMALL].end_tag_handler(pdoc, child);
690       }
691       /*----------------------------------------------------------------------*/
692       /* <SCRIPT>                                                             */
693       /*----------------------------------------------------------------------*/
694       else 
695       if (strcasecmp(name, "script") == 0) {
696         /* ignore script block */
697       }
698       else {
699         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
700       }
701       break;
702   
703     case 'd':
704     case 'D':
705       /*----------------------------------------------------------------------*/
706       /* <DIV>                                                                */
707       /*----------------------------------------------------------------------*/
708       if (strcasecmp(name, "div") == 0) {
709         if (handlers[tagDIV].start_tag_handler) 
710           handlers[tagDIV].start_tag_handler(pdoc, child);
711
712         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
713
714         if (handlers[tagDIV].end_tag_handler)
715           handlers[tagDIV].end_tag_handler(pdoc, child);
716       }
717       /*----------------------------------------------------------------------*/
718       /* <DIR>                                                                */
719       /*----------------------------------------------------------------------*/
720       else if (strcasecmp(name, "dir") == 0) {
721         if (handlers[tagDIR].start_tag_handler) 
722           handlers[tagDIR].start_tag_handler(pdoc, child);
723
724         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
725
726         if (handlers[tagDIR].end_tag_handler)
727           handlers[tagDIR].end_tag_handler(pdoc, child);
728       }
729       /*----------------------------------------------------------------------*/
730       /* <DL>                                                                 */
731       /*----------------------------------------------------------------------*/
732       else if (strcasecmp(name, "dl") == 0) {
733         if (handlers[tagDL].start_tag_handler) 
734           handlers[tagDL].start_tag_handler(pdoc, child);
735
736         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
737
738         if (handlers[tagDL].end_tag_handler)
739           handlers[tagDL].end_tag_handler(pdoc, child);
740       }
741       /*----------------------------------------------------------------------*/
742       /* <DT>                                                                 */
743       /*----------------------------------------------------------------------*/
744       else if (strcasecmp(name, "dt") == 0) {
745         if (handlers[tagDT].start_tag_handler) 
746           handlers[tagDT].start_tag_handler(pdoc, child);
747
748         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
749
750         if (handlers[tagDT].end_tag_handler)
751           handlers[tagDT].end_tag_handler(pdoc, child);
752       }
753       /*----------------------------------------------------------------------*/
754       /* <DD>                                                                 */
755       /*----------------------------------------------------------------------*/
756       else if (strcasecmp(name, "dd") == 0) {
757         if (handlers[tagDD].start_tag_handler) 
758           handlers[tagDD].start_tag_handler(pdoc, child);
759
760         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
761
762         if (handlers[tagDD].end_tag_handler)
763           handlers[tagDD].end_tag_handler(pdoc, child);
764       }
765       else {
766         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
767       }
768       break;
769
770     case 'c':
771     case 'C':
772       /*----------------------------------------------------------------------*/
773       /* NL (CrLf)                                                            */
774       /*----------------------------------------------------------------------*/
775       if (strcasecmp(name, QS_PARSE_NL_MARK) == 0) {
776         if (handlers[tagNLMARK].start_tag_handler) 
777           handlers[tagNLMARK].start_tag_handler(pdoc, child);
778       }
779       else
780       /*----------------------------------------------------------------------*/
781       /* <CENTER>                                                             */
782       /*----------------------------------------------------------------------*/
783       if (strcasecmp(name, "center") == 0) {
784         if (handlers[tagCENTER].start_tag_handler) 
785           handlers[tagCENTER].start_tag_handler(pdoc, child);
786
787         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
788
789         if (handlers[tagCENTER].end_tag_handler)
790           handlers[tagCENTER].end_tag_handler(pdoc, child);
791       }
792       /*----------------------------------------------------------------------*/
793       /* <CHXJ:IF>                                                            */
794       /*----------------------------------------------------------------------*/
795       else
796       if (strcasecmp(name, "chxj:if") == 0) {
797         if (chxj_chxjif_is_mine(spec, doc, child)) {
798           char* parse_attr;
799
800           parse_attr = qs_get_parse_attr(doc, child, r->pool);
801
802           if (parse_attr && strcasecmp(parse_attr, "true") == 0) {
803             chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
804           }
805           else {
806             if (handlers[tagCHXJIF].start_tag_handler)
807               handlers[tagCHXJIF].start_tag_handler(pdoc, child);
808           }
809         }
810       }
811       else {
812         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
813       }
814       break;
815
816     case 't':
817     case 'T':
818       /*----------------------------------------------------------------------*/
819       /* <TEXTAREA>                                                           */
820       /*----------------------------------------------------------------------*/
821       if (strcasecmp(name, "textarea") == 0) {
822         if (handlers[tagTEXTAREA].start_tag_handler) 
823           handlers[tagTEXTAREA].start_tag_handler(pdoc, child);
824
825         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
826
827         if (handlers[tagTEXTAREA].end_tag_handler)
828           handlers[tagTEXTAREA].end_tag_handler(pdoc, child);
829       }
830       else
831       /*----------------------------------------------------------------------*/
832       /* <TITLE>                                                              */
833       /*----------------------------------------------------------------------*/
834       if (strcasecmp(name, "title") == 0) {
835         if (handlers[tagTITLE].start_tag_handler) 
836           handlers[tagTITLE].start_tag_handler(pdoc, child);
837
838         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
839
840         if (handlers[tagTITLE].end_tag_handler)
841           handlers[tagTITLE].end_tag_handler(pdoc, child);
842       }
843       /*----------------------------------------------------------------------*/
844       /* <TABLE>                                                              */
845       /*----------------------------------------------------------------------*/
846       else
847       if (strcasecmp(name, "table") == 0) {
848         if (handlers[tagTABLE].start_tag_handler) 
849           handlers[tagTABLE].start_tag_handler(pdoc, child);
850
851         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
852
853         if (handlers[tagTABLE].end_tag_handler)
854           handlers[tagTABLE].end_tag_handler(pdoc, child);
855       }
856       /*----------------------------------------------------------------------*/
857       /* <TBODY>                                                              */
858       /*----------------------------------------------------------------------*/
859       else
860       if (strcasecmp(name, "tbody") == 0) {
861         if (handlers[tagTBODY].start_tag_handler) 
862           handlers[tagTBODY].start_tag_handler(pdoc, child);
863
864         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
865
866         if (handlers[tagTBODY].end_tag_handler)
867           handlers[tagTBODY].end_tag_handler(pdoc, child);
868       }
869       /*----------------------------------------------------------------------*/
870       /* <TH>                                                                 */
871       /*----------------------------------------------------------------------*/
872       else
873       if (strcasecmp(name, "th") == 0) {
874         if (handlers[tagTH].start_tag_handler) 
875           handlers[tagTH].start_tag_handler(pdoc, child);
876
877         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
878
879         if (handlers[tagTH].end_tag_handler)
880           handlers[tagTH].end_tag_handler(pdoc, child);
881       }
882       /*----------------------------------------------------------------------*/
883       /* <TR>                                                                 */
884       /*----------------------------------------------------------------------*/
885       else
886       if (strcasecmp(name, "tr") == 0) {
887         if (handlers[tagTR].start_tag_handler) 
888           handlers[tagTR].start_tag_handler(pdoc, child);
889
890         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
891
892         if (handlers[tagTR].end_tag_handler)
893           handlers[tagTR].end_tag_handler(pdoc, child);
894       }
895       /*----------------------------------------------------------------------*/
896       /* <TD>                                                                 */
897       /*----------------------------------------------------------------------*/
898       else
899       if (strcasecmp(name, "td") == 0) {
900         if (handlers[tagTD].start_tag_handler) 
901           handlers[tagTD].start_tag_handler(pdoc, child);
902
903         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
904
905         if (handlers[tagTD].end_tag_handler)
906           handlers[tagTD].end_tag_handler(pdoc, child);
907       }
908       /*----------------------------------------------------------------------*/
909       /* NORMAL TEXT                                                          */
910       /*----------------------------------------------------------------------*/
911       else
912       if (strcasecmp(name, "text") == 0) {
913         if (handlers[tagTEXT].start_tag_handler)
914           handlers[tagTEXT].start_tag_handler(pdoc, child);
915       }
916       else {
917         chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
918       }
919       break;
920
921     default:
922       chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
923     }
924   }
925
926   return NULL;
927 }
928 /*
929  * vim:ts=2 et
930  */