OSDN Git Service

* rename chxj_node_exchange --> chxj_node_convert
[modchxj/mod_chxj.git] / src / chxj_xhtml_mobile_1_0.c
1 /*
2  * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3  * Copyright (C) 2005 QSDN,Inc. 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 #include "chxj_encoding.h"
19 #include "chxj_xhtml_mobile_1_0.h"
20 #include "chxj_hdml.h"
21 #include "chxj_dump.h"
22 #include "chxj_img_conv.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_buffered_write.h"
25 #include "chxj_str_util.h"
26
27 #define GET_XHTML(X) ((xhtml_t*)(X))
28 #undef W_L
29 #undef W_V
30 #define W_L(X)          do { xhtml->out = BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, (X)); } while(0)
31 #define W_V(X)          do { xhtml->out = (X) ? BUFFERED_WRITE_VALUE(xhtml->out, &doc->buf, (X))  \
32                                                : BUFFERED_WRITE_LITERAL(xhtml->out, &doc->buf, ""); } while(0)
33
34 static char *s_xhtml_1_0_start_html_tag   (void *pdoc, Node *node);
35 static char *s_xhtml_1_0_end_html_tag     (void *pdoc, Node *node);
36 static char *s_xhtml_1_0_start_p_tag      (void *pdoc, Node *node);
37 static char *s_xhtml_1_0_end_p_tag        (void *pdoc, Node *node);
38 static char *s_xhtml_1_0_start_pre_tag    (void *pdoc, Node *node);
39 static char *s_xhtml_1_0_end_pre_tag      (void *pdoc, Node *node);
40 static char *s_xhtml_1_0_start_ul_tag     (void *pdoc, Node *node);
41 static char *s_xhtml_1_0_end_ul_tag       (void *pdoc, Node *node);
42 static char *s_xhtml_1_0_start_h1_tag     (void *pdoc, Node *node);
43 static char *s_xhtml_1_0_end_h1_tag       (void *pdoc, Node *node);
44 static char *s_xhtml_1_0_start_h2_tag     (void *pdoc, Node *node);
45 static char *s_xhtml_1_0_end_h2_tag       (void *pdoc, Node *node);
46 static char *s_xhtml_1_0_start_h3_tag     (void *pdoc, Node *node);
47 static char *s_xhtml_1_0_end_h3_tag       (void *pdoc, Node *node);
48 static char *s_xhtml_1_0_start_h4_tag     (void *pdoc, Node *node);
49 static char *s_xhtml_1_0_end_h4_tag       (void *pdoc, Node *node);
50 static char *s_xhtml_1_0_start_h5_tag     (void *pdoc, Node *node);
51 static char *s_xhtml_1_0_end_h5_tag       (void *pdoc, Node *node);
52 static char *s_xhtml_1_0_start_h6_tag     (void *pdoc, Node *node);
53 static char *s_xhtml_1_0_end_h6_tag       (void *pdoc, Node *node);
54 static char *s_xhtml_1_0_start_ol_tag     (void *pdoc, Node *node);
55 static char *s_xhtml_1_0_end_ol_tag       (void *pdoc, Node *node);
56 static char *s_xhtml_1_0_start_li_tag     (void *pdoc, Node *node);
57 static char *s_xhtml_1_0_end_li_tag       (void *pdoc, Node *node);
58 static char *s_xhtml_1_0_start_meta_tag   (void *pdoc, Node *node);
59 static char *s_xhtml_1_0_end_meta_tag     (void *pdoc, Node *node);
60 static char *s_xhtml_1_0_start_head_tag   (void *pdoc, Node *node);
61 static char *s_xhtml_1_0_end_head_tag     (void *pdoc, Node *node);
62 static char *s_xhtml_1_0_start_title_tag  (void *pdoc, Node *node);
63 static char *s_xhtml_1_0_end_title_tag    (void *pdoc, Node *node);
64 static char *s_xhtml_1_0_start_base_tag   (void *pdoc, Node *node);
65 static char *s_xhtml_1_0_end_base_tag     (void *pdoc, Node *node);
66 static char *s_xhtml_1_0_start_body_tag   (void *pdoc, Node *node);
67 static char *s_xhtml_1_0_end_body_tag     (void *pdoc, Node *node);
68 static char *s_xhtml_1_0_start_a_tag      (void *pdoc, Node *node);
69 static char *s_xhtml_1_0_end_a_tag        (void *pdoc, Node *node);
70 static char *s_xhtml_1_0_start_br_tag     (void *pdoc, Node *node);
71 static char *s_xhtml_1_0_end_br_tag       (void *pdoc, Node *node);
72 static char *s_xhtml_1_0_start_tr_tag     (void *pdoc, Node *node);
73 static char *s_xhtml_1_0_end_tr_tag       (void *pdoc, Node *node);
74 static char *s_xhtml_1_0_start_font_tag   (void *pdoc, Node *node);
75 static char *s_xhtml_1_0_end_font_tag     (void *pdoc, Node *node);
76 static char *s_xhtml_1_0_start_form_tag   (void *pdoc, Node *node);
77 static char *s_xhtml_1_0_end_form_tag     (void *pdoc, Node *node);
78 static char *s_xhtml_1_0_start_input_tag  (void *pdoc, Node *node);
79 static char *s_xhtml_1_0_end_input_tag    (void *pdoc, Node *node);
80 static char *s_xhtml_1_0_start_center_tag (void *pdoc, Node *node);
81 static char *s_xhtml_1_0_end_center_tag   (void *pdoc, Node *node);
82 static char *s_xhtml_1_0_start_hr_tag     (void *pdoc, Node *node);
83 static char *s_xhtml_1_0_end_hr_tag       (void *pdoc, Node *node);
84 static char *s_xhtml_1_0_start_img_tag    (void *pdoc, Node *node);
85 static char *s_xhtml_1_0_end_img_tag      (void *pdoc, Node *node);
86 static char *s_xhtml_1_0_start_select_tag (void *pdoc, Node *node);
87 static char *s_xhtml_1_0_end_select_tag   (void *pdoc, Node *node);
88 static char *s_xhtml_1_0_start_option_tag (void *pdoc, Node *node);
89 static char *s_xhtml_1_0_end_option_tag   (void *pdoc, Node *node);
90 static char *s_xhtml_1_0_start_div_tag       (void *pdoc, Node *node);
91 static char *s_xhtml_1_0_end_div_tag         (void *pdoc, Node *node);
92 static char *s_xhtml_1_0_start_textarea_tag  (void *pdoc, Node *node);
93 static char *s_xhtml_1_0_end_textarea_tag    (void *pdoc, Node *node);
94 static char *s_xhtml_1_0_start_b_tag         (void *pdoc, Node *node);
95 static char *s_xhtml_1_0_end_b_tag           (void *pdoc, Node *node);
96 static char *s_xhtml_1_0_chxjif_tag          (void *pdoc, Node *node);
97 static char *s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node);
98 static char *s_xhtml_1_0_end_blockquote_tag  (void *pdoc, Node *node);
99 static char *s_xhtml_1_0_start_dir_tag       (void *pdoc, Node *node);
100 static char *s_xhtml_1_0_end_dir_tag         (void *pdoc, Node *node);
101 static char *s_xhtml_1_0_start_dl_tag        (void *pdoc, Node *node);
102 static char *s_xhtml_1_0_end_dl_tag          (void *pdoc, Node *node);
103 static char *s_xhtml_1_0_start_dt_tag        (void *pdoc, Node *node);
104 static char *s_xhtml_1_0_end_dt_tag          (void *pdoc, Node *node);
105 static char *s_xhtml_1_0_start_dd_tag        (void *pdoc, Node *node);
106 static char *s_xhtml_1_0_end_dd_tag          (void *pdoc, Node *node);
107 static char *s_xhtml_1_0_start_menu_tag      (void *pdoc, Node *node);
108 static char *s_xhtml_1_0_end_menu_tag        (void *pdoc, Node *node);
109 static char *s_xhtml_1_0_start_plaintext_tag       (void *pdoc, Node *node);
110 static char *s_xhtml_1_0_start_plaintext_tag_inner (void *pdoc, Node *node);
111 static char *s_xhtml_1_0_end_plaintext_tag         (void *pdoc, Node *node);
112 static char *s_xhtml_1_0_start_blink_tag     (void *pdoc, Node *node);
113 static char *s_xhtml_1_0_end_blink_tag       (void *pdoc, Node *node);
114 static char *s_xhtml_1_0_start_marquee_tag   (void *pdoc, Node *node);
115 static char *s_xhtml_1_0_end_marquee_tag     (void *pdoc, Node *node);
116
117 static void  s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
118 static int   s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
119 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
120
121
122 tag_handler xhtml_handler[] = {
123   /* tagHTML */
124   {
125     s_xhtml_1_0_start_html_tag,
126     s_xhtml_1_0_end_html_tag,
127   },
128   /* tagMETA */
129   {
130     s_xhtml_1_0_start_meta_tag,
131     s_xhtml_1_0_end_meta_tag,
132   },
133   /* tagTEXTAREA */
134   {
135     s_xhtml_1_0_start_textarea_tag,
136     s_xhtml_1_0_end_textarea_tag,
137   },
138   /* tagP */
139   {
140     s_xhtml_1_0_start_p_tag,
141     s_xhtml_1_0_end_p_tag,
142   },
143   /* tagPRE */
144   {
145     s_xhtml_1_0_start_pre_tag,
146     s_xhtml_1_0_end_pre_tag,
147   },
148   /* tagUL */
149   {
150     s_xhtml_1_0_start_ul_tag,
151     s_xhtml_1_0_end_ul_tag,
152   },
153   /* tagLI */
154   {
155     s_xhtml_1_0_start_li_tag,
156     s_xhtml_1_0_end_li_tag,
157   },
158   /* tagOL */
159   {
160     s_xhtml_1_0_start_ol_tag,
161     s_xhtml_1_0_end_ol_tag,
162   },
163   /* tagH1 */
164   {
165     s_xhtml_1_0_start_h1_tag,
166     s_xhtml_1_0_end_h1_tag,
167   },
168   /* tagH2 */
169   {
170     s_xhtml_1_0_start_h2_tag,
171     s_xhtml_1_0_end_h2_tag,
172   },
173   /* tagH3 */
174   {
175     s_xhtml_1_0_start_h3_tag,
176     s_xhtml_1_0_end_h3_tag,
177   },
178   /* tagH4 */
179   {
180     s_xhtml_1_0_start_h4_tag,
181     s_xhtml_1_0_end_h4_tag,
182   },
183   /* tagH5 */
184   {
185     s_xhtml_1_0_start_h5_tag,
186     s_xhtml_1_0_end_h5_tag,
187   },
188   /* tagH6 */
189   {
190     s_xhtml_1_0_start_h6_tag,
191     s_xhtml_1_0_end_h6_tag,
192   },
193   /* tagHEAD */
194   {
195     s_xhtml_1_0_start_head_tag,
196     s_xhtml_1_0_end_head_tag,
197   },
198   /* tagTITLE */
199   {
200     s_xhtml_1_0_start_title_tag,
201     s_xhtml_1_0_end_title_tag,
202   },
203   /* tagBASE */
204   {
205     s_xhtml_1_0_start_base_tag,
206     s_xhtml_1_0_end_base_tag,
207   },
208   /* tagBODY */
209   {
210     s_xhtml_1_0_start_body_tag,
211     s_xhtml_1_0_end_body_tag,
212   },
213   /* tagA */
214   {
215     s_xhtml_1_0_start_a_tag,
216     s_xhtml_1_0_end_a_tag,
217   },
218   /* tagBR */
219   {
220     s_xhtml_1_0_start_br_tag,
221     s_xhtml_1_0_end_br_tag,
222   },
223   /* tagTABLE */
224   {
225     NULL,
226     NULL,
227   },
228   /* tagTR */
229   {
230     s_xhtml_1_0_start_tr_tag,
231     s_xhtml_1_0_end_tr_tag,
232   },
233   /* tagTD */
234   {
235     NULL,
236     NULL,
237   },
238   /* tagTBODY */
239   {
240     NULL,
241     NULL,
242   },
243   /* tagFONT */
244   {
245     s_xhtml_1_0_start_font_tag,
246     s_xhtml_1_0_end_font_tag,
247   },
248   /* tagFORM */
249   {
250     s_xhtml_1_0_start_form_tag,
251     s_xhtml_1_0_end_form_tag,
252   },
253   /* tagINPUT */
254   {
255     s_xhtml_1_0_start_input_tag,
256     s_xhtml_1_0_end_input_tag,
257   },
258   /* tagCENTER */
259   {
260     s_xhtml_1_0_start_center_tag,
261     s_xhtml_1_0_end_center_tag,
262   },
263   /* tagHR */
264   {
265     s_xhtml_1_0_start_hr_tag,
266     s_xhtml_1_0_end_hr_tag,
267   },
268   /* tagIMG */
269   {
270     s_xhtml_1_0_start_img_tag,
271     s_xhtml_1_0_end_img_tag,
272   },
273   /* tagSELECT */
274   {
275     s_xhtml_1_0_start_select_tag,
276     s_xhtml_1_0_end_select_tag,
277   },
278   /* tagOPTION */
279   {
280     s_xhtml_1_0_start_option_tag,
281     s_xhtml_1_0_end_option_tag,
282   },
283   /* tagDIV */
284   {
285     s_xhtml_1_0_start_div_tag,
286     s_xhtml_1_0_end_div_tag,
287   },
288   /* tagCHXJIF */
289   {
290     s_xhtml_1_0_chxjif_tag,
291     NULL,
292   },
293   /* tagNOBR */
294   {
295     NULL,
296     NULL,
297   },
298   /* tagSMALL */
299   {
300     NULL,
301     NULL,
302   },
303   /* tagSTYLE */
304   {
305     NULL,
306     NULL,
307   },
308   /* tagSPAN */
309   {
310     NULL,
311     NULL,
312   },
313   /* tagTEXT */
314   {
315     s_xhtml_1_0_text_tag,
316     NULL,
317   },
318   /* tagTH */
319   {
320     NULL,
321     NULL,
322   },
323   /* tagB */
324   {
325     s_xhtml_1_0_start_b_tag,
326     s_xhtml_1_0_end_b_tag,
327   },
328   /* tagFIELDSET */
329   {
330     NULL,
331     NULL,
332   },
333   /* tagDT */
334   {
335     s_xhtml_1_0_start_dt_tag,
336     s_xhtml_1_0_end_dt_tag,
337   },
338   /* tagLEGEND */
339   {
340     NULL,
341     NULL,
342   },
343   /* tagLABEL */
344   {
345     NULL,
346     NULL,
347   },
348   /* tagBLOCKQUOTE */
349   {
350     s_xhtml_1_0_start_blockquote_tag,
351     s_xhtml_1_0_end_blockquote_tag,
352   },
353   /* tagDIR */
354   {
355     s_xhtml_1_0_start_dir_tag,
356     s_xhtml_1_0_end_dir_tag,
357   },
358   /* tagDL */
359   {
360     s_xhtml_1_0_start_dl_tag,
361     s_xhtml_1_0_end_dl_tag,
362   },
363   /* tagDD */
364   {
365     s_xhtml_1_0_start_dd_tag,
366     s_xhtml_1_0_end_dd_tag,
367   },
368   /* tagMENU */
369   {
370     s_xhtml_1_0_start_menu_tag,
371     s_xhtml_1_0_end_menu_tag,
372   },
373   /* tagPLAINTEXT */
374   {
375     s_xhtml_1_0_start_plaintext_tag,
376     s_xhtml_1_0_end_plaintext_tag,
377   },
378   /* tagBLINK */
379   {
380     s_xhtml_1_0_start_blink_tag,
381     s_xhtml_1_0_end_blink_tag,
382   },
383   /* tagMARQUEE */
384   {
385     s_xhtml_1_0_start_marquee_tag,
386     s_xhtml_1_0_end_marquee_tag,
387   },
388 };
389  
390 /**
391  * converts from CHTML to XHTML.
392  *
393  * @param r     [i]   Requet_rec is appointed.
394  * @param spec  [i]   The result of the device specification processing which 
395  *                    was done in advance is appointed.
396  * @param src   [i]   The character string before the converting is appointed.
397  * @return The character string after the converting is returned.
398  */
399 char *
400 chxj_exchange_xhtml_mobile_1_0(
401   request_rec        *r,
402   device_table       *spec,
403   const char         *src,
404   apr_size_t         srclen,
405   apr_size_t         *dstlen,
406   chxjconvrule_entry *entryp,
407   cookie_t           *UNUSED(cookie)
408 )
409 {
410   char      *dst = NULL;
411   char      *ss;
412   xhtml_t   xhtml;
413   Doc       doc;
414
415   DBG(r,"start chxj_exchange_xhtml_mobile_1_0()");
416   /*--------------------------------------------------------------------------*/
417   /* If qrcode xml                                                            */
418   /*--------------------------------------------------------------------------*/
419   *dstlen = srclen;
420   dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
421   if (dst != NULL) {
422     DBG(r,"end chxj_exchange_xhtml_mobile_1_0() (found qrcode.xml)");
423     return dst;
424   }
425
426   /*--------------------------------------------------------------------------*/
427   /* The XHTML structure is initialized.                                      */
428   /*--------------------------------------------------------------------------*/
429   s_init_xhtml(&xhtml, &doc, r, spec);
430
431   xhtml.entryp = entryp;
432
433   chxj_set_content_type(r, "text/html; charset=Windows-31J");
434
435   /*--------------------------------------------------------------------------*/
436   /* The character string of the input is analyzed.                           */
437   /*--------------------------------------------------------------------------*/
438   qs_init_malloc(&doc);
439   qs_init_root_node(&doc);
440
441   ss = apr_pcalloc(r->pool, srclen + 1);
442   memset(ss,   0, srclen + 1);
443   memcpy(ss, src, srclen);
444
445 #ifdef DUMP_LOG
446   chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
447 #endif
448   qs_parse_string(&doc,ss, strlen(ss));
449
450   chxj_buffered_write_init(r->pool, &doc.buf);
451   /*--------------------------------------------------------------------------*/
452   /* It converts it from CHTML to XHTML.                                      */
453   /*--------------------------------------------------------------------------*/
454   chxj_node_convert(spec,r,(void *)&xhtml, &doc, qs_get_root(&doc), 0);
455   xhtml.out = chxj_buffered_write_flush(xhtml.out, &doc.buf);
456   dst = apr_pstrdup(r->pool, xhtml.out);
457   chxj_buffered_write_terminate(&doc.buf);
458
459   qs_all_free(&doc,QX_LOGMARK);
460
461   if (! dst) {
462     return apr_pstrdup(r->pool,ss);
463   }
464
465   if (! *dst) {
466     dst = apr_psprintf(r->pool, "\n");
467   }
468   *dstlen = strlen(dst);
469
470 #ifdef DUMP_LOG
471   chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
472 #endif
473
474   DBG(r,"end chxj_exchange_xhtml_mobile_1_0()");
475   return dst;
476 }
477
478
479 /**
480  * The XHTML structure is initialized.
481  *
482  * @param xhtml [i/o] The pointer to the HDML structure that wants to be
483  *                   initialized is specified.
484  * @param doc   [i]   The Doc structure that should be set to the initialized
485  *                   HDML structure is specified.
486  * @param r     [i]   To use POOL, the pointer to request_rec is specified.
487  * @param spec  [i]   The pointer to the device_table
488  */
489 static void
490 s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec)
491 {
492   memset(doc,   0, sizeof(Doc));
493   memset(xhtml, 0, sizeof(xhtml_t));
494
495   doc->r      = r;
496   xhtml->doc  = doc;
497   xhtml->spec = spec;
498   xhtml->out  = qs_alloc_zero_byte_string(r);
499   xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
500   xhtml->doc->parse_mode = PARSE_MODE_CHTML;
501 }
502
503
504 /**
505  * Corresponding EMOJI to a current character-code is retrieved. 
506  * The substitution character string is stored in the rslt pointer if agreeing.
507  *
508  * @param xhtml   [i]   The pointer to the XHTML structure is specified. 
509  * @param txt     [i]   The character string to want to examine whether it is 
510  *                      EMOJI is specified. 
511  * @param rslt    [o]   The pointer to the pointer that stores the result is 
512  *                      specified. 
513  * @return When corresponding EMOJI exists, it returns it excluding 0. 
514  */
515 static int
516 s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
517 {
518   emoji_t       *ee;
519   request_rec   *r;
520   device_table  *spec;
521   int           len;
522
523   spec = xhtml->spec;
524
525   len = strlen(txt);
526   r = xhtml->doc->r;
527
528   if (spec == NULL) {
529     DBG(r,"spec is NULL");
530   }
531
532   for (ee = xhtml->conf->emoji;
533        ee;
534        ee = ee->next) {
535     unsigned char hex1byte;
536     unsigned char hex2byte;
537     if (!ee->imode) {
538       DBG(r,"emoji->imode is NULL");
539       continue;
540     }
541
542     if (ee->imode->string != NULL
543     &&  strlen(ee->imode->string) > 0
544     &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
545       if (spec == NULL || spec->emoji_type == NULL) {
546         *rslt = apr_psprintf(r->pool,
547                         "<img localsrc=%s>",
548                         ee->ezweb->typeA);
549         return strlen(ee->imode->string);
550       }
551
552       if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
553         *rslt = apr_psprintf(r->pool,
554                         "<img localsrc=%s>",
555                         ee->ezweb->typeA);
556         return strlen(ee->imode->string);
557       } 
558       else
559       if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
560         *rslt = apr_psprintf(r->pool,
561                         "<img localsrc=%s>",
562                         ee->ezweb->typeB);
563         return strlen(ee->imode->string);
564       }
565       else
566       if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
567         *rslt = apr_psprintf(r->pool,
568                         "<img localsrc=%s>",
569                         ee->ezweb->typeC);
570         return strlen(ee->imode->string);
571       }
572       else
573       if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
574         *rslt = apr_psprintf(r->pool,
575                         "<img localsrc=%s>",
576                         ee->ezweb->typeD);
577         return strlen(ee->imode->string);
578       }
579       else {
580         *rslt = apr_psprintf(r->pool,
581                         "<img localsrc=%s>",
582                         ee->ezweb->typeA);
583         return strlen(ee->imode->string);
584       }
585       return 0;
586     }
587     hex1byte = ee->imode->hex1byte & 0xff;
588     hex2byte = ee->imode->hex2byte & 0xff;
589     if (len >= 2
590     && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
591     && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
592       if (spec == NULL || spec->emoji_type == NULL) {
593         *rslt = apr_psprintf(r->pool,
594                         "<img localsrc=\"%s\">",
595                         ee->ezweb->typeA);
596         return 2;
597       }
598
599       if (strcasecmp(xhtml->spec->emoji_type, "a") == 0) {
600         *rslt = apr_psprintf(r->pool,
601                         "<img localsrc=\"%s\">",
602                         ee->ezweb->typeA);
603         return 2;
604       } 
605       else
606       if (strcasecmp(xhtml->spec->emoji_type, "b") == 0) {
607         *rslt = apr_psprintf(r->pool,
608                         "<img localsrc=\"%s\">",
609                         ee->ezweb->typeB);
610         return 2;
611       }
612       else
613       if (strcasecmp(xhtml->spec->emoji_type, "c") == 0) {
614         *rslt = apr_psprintf(r->pool,
615                         "<img localsrc=\"%s\">",
616                         ee->ezweb->typeC);
617         return 2;
618       }
619       else
620       if (strcasecmp(xhtml->spec->emoji_type, "d") == 0) {
621         *rslt = apr_psprintf(r->pool,
622                         "<img localsrc=\"%s\">",
623                         ee->ezweb->typeD);
624         return 2;
625       }
626       else {
627         *rslt = apr_psprintf(r->pool,
628                         "<img localsrc=\"%s\">",
629                         ee->ezweb->typeD);
630         return 2;
631       }
632       return 0;
633     }
634   }
635   return 0;
636 }
637
638
639 /**
640  * It is a handler who processes the HTML tag.
641  *
642  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
643  *                     destination is specified.
644  * @param node   [i]   The HTML tag node is specified.
645  * @return The conversion result is returned.
646  */
647 static char *
648 s_xhtml_1_0_start_html_tag(void *pdoc, Node *node) 
649 {
650   xhtml_t       *xhtml = GET_XHTML(pdoc);
651   Attr          *attr;
652   Doc           *doc   = xhtml->doc;
653
654   /*--------------------------------------------------------------------------*/
655   /* Add XML Declare                                                          */
656   /*--------------------------------------------------------------------------*/
657   W_L("<?xml version=\"1.0\" encoding=\"Windows-31J\"?>\r\n");
658   /*--------------------------------------------------------------------------*/
659   /* Add DocType                                                              */
660   /*--------------------------------------------------------------------------*/
661   W_L("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"\r\n");
662   W_L(" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">\r\n");
663   /*--------------------------------------------------------------------------*/
664   /* start HTML tag                                                           */
665   /*--------------------------------------------------------------------------*/
666   W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\"");
667   /*--------------------------------------------------------------------------*/
668   /* Get Attributes                                                           */
669   /*--------------------------------------------------------------------------*/
670   for (attr = qs_get_attr(doc,node);
671        attr; 
672        attr = qs_get_next_attr(doc,attr)) {
673     char* name  = qs_get_attr_name(doc,attr);
674     char* value = qs_get_attr_value(doc,attr);
675     if (STRCASEEQ('l','L',"lang", name)) {
676       W_L(" xml:lang=\"");
677       W_V(value);
678       W_L("\"");
679     }
680     else if (STRCASEEQ('v','V',"version", name)) {
681       W_L(" version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"");
682     }
683   }
684   W_L(">\r\n");
685   return xhtml->out;
686 }
687
688
689 /**
690  * It is a handler who processes the HTML tag.
691  *
692  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
693  *                     destination is specified.
694  * @param node   [i]   The HTML tag node is specified.
695  * @return The conversion result is returned.
696  */
697 static char *
698 s_xhtml_1_0_end_html_tag(void *pdoc, Node *UNUSED(child)) 
699 {
700   xhtml_t       *xhtml = GET_XHTML(pdoc);
701   Doc           *doc   = xhtml->doc;
702   W_L("</html>\r\n");
703   return xhtml->out;
704 }
705
706
707 /**
708  * It is a handler who processes the META tag.
709  *
710  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
711  *                     destination is specified.
712  * @param node   [i]   The META tag node is specified.
713  * @return The conversion result is returned.
714  */
715 static char *
716 s_xhtml_1_0_start_meta_tag(void *pdoc, Node *node) 
717 {
718   xhtml_t       *xhtml = GET_XHTML(pdoc);
719   Attr          *attr;
720   Doc           *doc   = xhtml->doc;
721   int           content_type_flag = 0;
722
723   W_L("<meta");
724   /*--------------------------------------------------------------------------*/
725   /* Get Attributes                                                           */
726   /*--------------------------------------------------------------------------*/
727   for (attr = qs_get_attr(doc,node);
728        attr; 
729        attr = qs_get_next_attr(doc,attr)) {
730     char *name  = qs_get_attr_name(doc,attr);
731     char *value = qs_get_attr_value(doc,attr);
732     if (STRCASEEQ('n','N',"name", name) && value && *value) {
733       W_L(" ");
734       W_V(name);
735       W_L("=\"");
736       W_V(value);
737       W_L("\"");
738     }
739     else if (STRCASEEQ('h','H',"http-equiv", name) && value && *value) {
740       W_L(" ");
741       W_V(name);
742       W_L("=\"");
743       W_V(value);
744       W_L("\"");
745       if (STRCASEEQ('c','C', "content-type", value)) {
746         content_type_flag = 1;
747       }
748     }
749     else if (STRCASEEQ('c','C',"content", name) && value && *value) {
750       if (content_type_flag) {
751         W_L(" ");
752         W_V(name);
753         W_L("=\"");
754         W_L("text/html; charset=Windows-31J");
755         W_L("\"");
756       }
757       else {
758         W_L(" ");
759         W_V(name);
760         W_L("=\"");
761         W_V(value);
762         W_L("\"");
763       }
764     }
765   }
766   W_L(" />\r\n");
767   return xhtml->out;
768 }
769
770
771 /**
772  * It is a handler who processes the META tag.
773  *
774  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
775  *                     destination is specified.
776  * @param node   [i]   The META tag node is specified.
777  * @return The conversion result is returned.
778  */
779 static char *
780 s_xhtml_1_0_end_meta_tag(void *pdoc, Node *UNUSED(child)) 
781 {
782   xhtml_t *xhtml = GET_XHTML(pdoc);
783
784   return xhtml->out;
785 }
786
787
788 /**
789  * It is a handler who processes the HEAD tag.
790  *
791  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
792  *                     destination is specified.
793  * @param node   [i]   The HEAD tag node is specified.
794  * @return The conversion result is returned.
795  */
796 static char *
797 s_xhtml_1_0_start_head_tag(void *pdoc, Node *UNUSED(node)) 
798 {
799   xhtml_t       *xhtml = GET_XHTML(pdoc);
800   Doc           *doc   = xhtml->doc;
801
802   W_L("<head>\r\n");
803   return xhtml->out;
804 }
805
806
807 /**
808  * It is a handler who processes the HEAD tag.
809  *
810  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
811  *                     destination is specified.
812  * @param node   [i]   The HEAD tag node is specified.
813  * @return The conversion result is returned.
814  */
815 static char *
816 s_xhtml_1_0_end_head_tag(void *pdoc, Node *UNUSED(child)) 
817 {
818   xhtml_t       *xhtml = GET_XHTML(pdoc);
819   Doc           *doc   = xhtml->doc;
820
821   W_L("</head>\r\n");
822   return xhtml->out;
823 }
824
825
826 /**
827  * It is a handler who processes the TITLE tag.
828  *
829  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
830  *                     destination is specified.
831  * @param node   [i]   The TITLE tag node is specified.
832  * @return The conversion result is returned.
833  */
834 static char *
835 s_xhtml_1_0_start_title_tag(void *pdoc, Node *UNUSED(node)) 
836 {
837   xhtml_t      *xhtml = GET_XHTML(pdoc);
838   Doc          *doc   = xhtml->doc;
839
840   W_L("<title>");
841   return xhtml->out;
842 }
843
844
845 /**
846  * It is a handler who processes the TITLE tag.
847  *
848  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
849  *                     destination is specified.
850  * @param node   [i]   The TITLE tag node is specified.
851  * @return The conversion result is returned.
852  */
853 static char *
854 s_xhtml_1_0_end_title_tag(void *pdoc, Node *UNUSED(child)) 
855 {
856   xhtml_t       *xhtml = GET_XHTML(pdoc);
857   Doc           *doc   = xhtml->doc;
858
859   W_L("</title>\r\n");
860   return xhtml->out;
861 }
862
863
864 /**
865  * It is a handler who processes the BASE tag.
866  *
867  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
868  *                     destination is specified.
869  * @param node   [i]   The BASE tag node is specified.
870  * @return The conversion result is returned.
871  */
872 static char *
873 s_xhtml_1_0_start_base_tag(void *pdoc, Node *node) 
874 {
875   xhtml_t       *xhtml = GET_XHTML(pdoc);
876   Attr          *attr;
877   Doc           *doc   = xhtml->doc;
878
879   W_L("<base");
880   /*--------------------------------------------------------------------------*/
881   /* Get Attributes                                                           */
882   /*--------------------------------------------------------------------------*/
883   for (attr = qs_get_attr(doc,node);
884        attr;
885        attr = qs_get_next_attr(doc,attr)) {
886     char *name = qs_get_attr_name(doc,attr);
887     char *value = qs_get_attr_value(doc,attr);
888     if (STRCASEEQ('h','H',"href",name)) {
889       W_L(" href=\"");
890       W_V(value);
891       W_L("\"");
892       break;
893     }
894   }
895   W_L(" />\r\n");
896   return xhtml->out;
897 }
898
899
900 /**
901  * It is a handler who processes the BASE tag.
902  *
903  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
904  *                     destination is specified.
905  * @param node   [i]   The BASE tag node is specified.
906  * @return The conversion result is returned.
907  */
908 static char *
909 s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child)) 
910 {
911   xhtml_t *xhtml = GET_XHTML(pdoc);
912
913   return xhtml->out;
914 }
915
916
917 /**
918  * It is a handler who processes the BODY tag.
919  *
920  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
921  *                     destination is specified.
922  * @param node   [i]   The BODY tag node is specified.
923  * @return The conversion result is returned.
924  */
925 static char *
926 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node) 
927 {
928   xhtml_t      *xhtml = GET_XHTML(pdoc);
929   Doc          *doc   = xhtml->doc;
930   Attr         *attr;
931
932   W_L("<body");
933   /*--------------------------------------------------------------------------*/
934   /* Get Attributes                                                           */
935   /*--------------------------------------------------------------------------*/
936   for (attr = qs_get_attr(doc,node);
937        attr;
938        attr = qs_get_next_attr(doc,attr)) {
939     char *name  = qs_get_attr_name(doc,attr);
940     char *value = qs_get_attr_value(doc,attr);
941     if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
942       W_L(" bgcolor=\"");
943       W_V(value);
944       W_L("\"");
945     }
946     else if (STRCASEEQ('t','T',"text",name) && value && *value) {
947       W_L(" text=\"");
948       W_V(value);
949       W_L("\"");
950     }
951     else if (STRCASEEQ('l','L',"link", name) && value && *value) {
952       W_L(" link=\"");
953       W_V(value);
954       W_L("\"");
955     }
956     else if (STRCASEEQ('a','A',"alink", name)) {
957       /* ignore */
958     }
959     else if (STRCASEEQ('v','V',"vlink",name)) {
960       /* ignore */
961     }
962   }
963   W_L(">\r\n");
964   return xhtml->out;
965 }
966
967
968 /**
969  * It is a handler who processes the BODY tag.
970  *
971  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
972  *                     destination is specified.
973  * @param node   [i]   The BODY tag node is specified.
974  * @return The conversion result is returned.
975  */
976 static char *
977 s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child)) 
978 {
979   xhtml_t       *xhtml = GET_XHTML(pdoc);
980   Doc           *doc   = xhtml->doc;
981
982   W_L("</body>\r\n");
983   return xhtml->out;
984 }
985
986
987 /**
988  * It is a handler who processes the A tag.
989  *
990  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
991  *                     destination is specified.
992  * @param node   [i]   The A tag node is specified.
993  * @return The conversion result is returned.
994  */
995 static char *
996 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node) 
997 {
998   xhtml_t       *xhtml = GET_XHTML(pdoc);
999   Doc           *doc   = xhtml->doc;
1000   request_rec   *r     = doc->r;
1001   Attr          *attr;
1002
1003   W_L("<a");
1004   /*--------------------------------------------------------------------------*/
1005   /* Get Attributes                                                           */
1006   /*--------------------------------------------------------------------------*/
1007   for (attr = qs_get_attr(doc,node);
1008        attr; 
1009        attr = qs_get_next_attr(doc,attr)) {
1010     char* name  = qs_get_attr_name(doc,attr);
1011     char* value = qs_get_attr_value(doc,attr);
1012     if (STRCASEEQ('n','N',"name",name) && value && *value) {
1013       W_L(" id=\"");
1014       W_V(value);
1015       W_L("\"");
1016     }
1017     else if (STRCASEEQ('h','H',"href", name) && value && *value) {
1018       value = chxj_encoding_parameter(r, value);
1019       W_L(" href=\"");
1020       W_V(value);
1021       W_L("\"");
1022     }
1023     else if (STRCASEEQ('a','A',"accesskey", name)) {
1024       W_L(" accesskey=\"");
1025       W_V(value);
1026       W_L("\"");
1027     }
1028     else if (STRCASEEQ('c','C',"cti",name)) {
1029       /* ignore */
1030     }
1031     else if (STRCASEEQ('i','I',"ijam", name)) {
1032       /* ignore */
1033     }
1034     else if (STRCASEEQ('u','U',"utn", name)) {
1035       /* ignore */
1036     }
1037     else if (STRCASEEQ('t','T',"telbook",name)) {
1038       /* ignore */
1039     }
1040     else if (STRCASEEQ('k','K',"kana",name)) {
1041       /* ignore */
1042     }
1043     else if (STRCASEEQ('e','E',"email",name)) {
1044       /* ignore */
1045     }
1046     else if (STRCASEEQ('i','I',"ista",name)) {
1047       /* ignore */
1048     }
1049     else if (STRCASEEQ('i','I',"ilet",name)) {
1050       /* ignore */
1051     }
1052     else if (STRCASEEQ('i','I',"iswf",name)) {
1053       /* ignore */
1054     }
1055     else if (STRCASEEQ('i','I',"irst",name)) {
1056       /* ignore */
1057     }
1058   }
1059   W_L(">");
1060   return xhtml->out;
1061 }
1062
1063
1064 /**
1065  * It is a handler who processes the A tag.
1066  *
1067  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1068  *                     destination is specified.
1069  * @param node   [i]   The A tag node is specified.
1070  * @return The conversion result is returned.
1071  */
1072 static char *
1073 s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child)) 
1074 {
1075   xhtml_t *xhtml = GET_XHTML(pdoc);
1076   Doc     *doc   = xhtml->doc;
1077
1078   W_L("</a>");
1079   return xhtml->out;
1080 }
1081
1082
1083 /**
1084  * It is a handler who processes the BR tag.
1085  *
1086  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1087  *                     destination is specified.
1088  * @param node   [i]   The BR tag node is specified.
1089  * @return The conversion result is returned.
1090  */
1091 static char *
1092 s_xhtml_1_0_start_br_tag(void *pdoc, Node *node) 
1093 {
1094   xhtml_t *xhtml = GET_XHTML(pdoc);
1095   Doc     *doc   = xhtml->doc;
1096   Attr    *attr;
1097
1098   W_L("<br");
1099   /*--------------------------------------------------------------------------*/
1100   /* Get Attributes                                                           */
1101   /*--------------------------------------------------------------------------*/
1102   for (attr = qs_get_attr(doc,node);
1103        attr;
1104        attr = qs_get_next_attr(doc,attr)) {
1105     char *name  = qs_get_attr_name(doc,attr);
1106     char *value = qs_get_attr_value(doc,attr);
1107     if (STRCASEEQ('c','C',"clear",name)) {
1108       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1109         W_L(" clear=\"");
1110         W_V(value);
1111         W_L("\"");
1112       }
1113     }
1114   }
1115   W_L(" />\r\n");
1116   return xhtml->out;
1117 }
1118
1119
1120 /**
1121  * It is a handler who processes the BR tag.
1122  *
1123  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1124  *                     destination is specified.
1125  * @param node   [i]   The BR tag node is specified.
1126  * @return The conversion result is returned.
1127  */
1128 static char *
1129 s_xhtml_1_0_end_br_tag(void *pdoc, Node *UNUSED(child)) 
1130 {
1131   xhtml_t *xhtml = GET_XHTML(pdoc);
1132
1133   return xhtml->out;
1134 }
1135
1136
1137 /**
1138  * It is a handler who processes the TR tag.
1139  *
1140  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1141  *                     destination is specified.
1142  * @param node   [i]   The TR tag node is specified.
1143  * @return The conversion result is returned.
1144  */
1145 static char *
1146 s_xhtml_1_0_start_tr_tag(void *pdoc, Node *UNUSED(node)) 
1147 {
1148   xhtml_t *xhtml = GET_XHTML(pdoc);
1149   Doc     *doc   = xhtml->doc;
1150
1151   W_L("<br />\r\n");
1152   return xhtml->out;
1153 }
1154
1155
1156 /**
1157  * It is a handler who processes the TR tag.
1158  *
1159  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1160  *                     destination is specified.
1161  * @param node   [i]   The TR tag node is specified.
1162  * @return The conversion result is returned.
1163  */
1164 static char *
1165 s_xhtml_1_0_end_tr_tag(void *pdoc, Node *UNUSED(child)) 
1166 {
1167   xhtml_t *xhtml = GET_XHTML(pdoc);
1168
1169   return xhtml->out;
1170 }
1171
1172
1173 /**
1174  * It is a handler who processes the FONT tag.
1175  *
1176  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1177  *                     destination is specified.
1178  * @param node   [i]   The FONT tag node is specified.
1179  * @return The conversion result is returned.
1180  */
1181 static char *
1182 s_xhtml_1_0_start_font_tag(void *pdoc, Node *node) 
1183 {
1184   xhtml_t *xhtml = GET_XHTML(pdoc);
1185   Doc     *doc   = xhtml->doc;
1186   Attr    *attr;
1187
1188   W_L("<font");
1189   /*=========================================================================*/
1190   /* Get Attributes                                                          */
1191   /*=========================================================================*/
1192   for (attr = qs_get_attr(doc,node);
1193        attr;
1194        attr = qs_get_next_attr(doc,attr)) {
1195     char *name = qs_get_attr_name(doc,attr);
1196     char *value = qs_get_attr_value(doc,attr);
1197     if (STRCASEEQ('c','C',"color",name) && value && *value) {
1198       W_L(" color=\"");
1199       W_V(value);
1200       W_L("\"");
1201     }
1202     else if (STRCASEEQ('s','S',"size",name) && value && *value) {
1203       W_L(" size=\"");
1204       W_V(value);
1205       W_L("\"");
1206     }
1207   }
1208   W_L(">");
1209   return xhtml->out;
1210 }
1211
1212
1213 /**
1214  * It is a handler who processes the FONT tag.
1215  *
1216  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1217  *                     destination is specified.
1218  * @param node   [i]   The FONT tag node is specified.
1219  * @return The conversion result is returned.
1220  */
1221 static char *
1222 s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child)) 
1223 {
1224   xhtml_t *xhtml = GET_XHTML(pdoc);
1225   Doc     *doc   = xhtml->doc;
1226
1227   W_L("</font>");
1228   return xhtml->out;
1229 }
1230
1231
1232 /**
1233  * It is a handler who processes the FORM tag.
1234  *
1235  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1236  *                     destination is specified.
1237  * @param node   [i]   The FORM tag node is specified.
1238  * @return The conversion result is returned.
1239  */
1240 static char *
1241 s_xhtml_1_0_start_form_tag(void *pdoc, Node *node) 
1242 {
1243   xhtml_t     *xhtml = GET_XHTML(pdoc);
1244   Doc         *doc   = xhtml->doc;
1245   request_rec *r     = doc->r;
1246   Attr        *attr;
1247
1248   W_L("<form");
1249   /*--------------------------------------------------------------------------*/
1250   /* Get Attributes                                                           */
1251   /*--------------------------------------------------------------------------*/
1252   for (attr = qs_get_attr(doc,node);
1253        attr;
1254        attr = qs_get_next_attr(doc,attr)) {
1255     char *name = qs_get_attr_name(doc,attr);
1256     char *value = qs_get_attr_value(doc,attr);
1257     if (STRCASEEQ('a','A',"action",name)) {
1258       value = chxj_encoding_parameter(r, value);
1259       W_L(" action=\"");
1260       W_V(value);
1261       W_L("\"");
1262     }
1263     else if (STRCASEEQ('m','M',"method",name)) {
1264       W_L(" method=\"");
1265       W_V(value);
1266       W_L("\"");
1267     }
1268     else if (STRCASEEQ('u','U',"utn",name)) {
1269       /* ignore */
1270     }
1271   }
1272   W_L(">");
1273   return xhtml->out;
1274 }
1275
1276
1277 /**
1278  * It is a handler who processes the FORM tag.
1279  *
1280  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1281  *                     destination is specified.
1282  * @param node   [i]   The FORM tag node is specified.
1283  * @return The conversion result is returned.
1284  */
1285 static char *
1286 s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child)) 
1287 {
1288   xhtml_t *xhtml = GET_XHTML(pdoc);
1289   Doc     *doc   = xhtml->doc;
1290
1291   W_L("</form>");
1292   return xhtml->out;
1293 }
1294
1295
1296 /**
1297  * It is a handler who processes the INPUT tag.
1298  *
1299  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1300  *                     destination is specified.
1301  * @param node   [i]   The INPUT tag node is specified.
1302  * @return The conversion result is returned.
1303  */
1304 static char *
1305 s_xhtml_1_0_start_input_tag(void *pdoc, Node *node) 
1306 {
1307   xhtml_t     *xhtml       = GET_XHTML(pdoc);
1308   Doc         *doc         = xhtml->doc;
1309   request_rec *r           = doc->r;
1310   char        *max_length  = NULL;
1311   char        *type        = NULL;
1312   char        *name        = NULL;
1313   char        *value       = NULL;
1314   char        *istyle      = NULL;
1315   char        *size        = NULL;
1316   char        *checked     = NULL;
1317   char        *accesskey   = NULL;
1318
1319   W_L("<input");
1320   /*--------------------------------------------------------------------------*/
1321   /* Get Attributes                                                           */
1322   /*--------------------------------------------------------------------------*/
1323   type       = qs_get_type_attr(doc, node, r);
1324   name       = qs_get_name_attr(doc, node, r);
1325   value      = qs_get_value_attr(doc,node,r);
1326   istyle     = qs_get_istyle_attr(doc,node,r);
1327   max_length = qs_get_maxlength_attr(doc,node,r);
1328   checked    = qs_get_checked_attr(doc,node,r);
1329   accesskey  = qs_get_accesskey_attr(doc, node, r);
1330   size       = qs_get_size_attr(doc, node, r);
1331
1332   if (type) {
1333     type = qs_trim_string(doc->buf.pool, type);
1334     if (type && (STRCASEEQ('t','T',"text",    type) ||
1335                  STRCASEEQ('p','P',"password",type) ||
1336                  STRCASEEQ('c','C',"checkbox",type) ||
1337                  STRCASEEQ('r','R',"radio",   type) ||
1338                  STRCASEEQ('h','H',"hidden",  type) ||
1339                  STRCASEEQ('s','S',"submit",  type) ||
1340                  STRCASEEQ('r','R',"reset",   type))) {
1341       W_L(" type=\"");
1342       W_V(type);
1343       W_L("\"");
1344     }
1345   }
1346   if (size && *size) {
1347     W_L(" size=\"");
1348     W_V(size);
1349     W_L("\"");
1350   }
1351   if (name && *name) {
1352     W_L(" name=\"");
1353     W_V(name);
1354     W_L("\"");
1355   }
1356   if (value && *value) {
1357     W_L(" value=\"");
1358     W_V(value);
1359     W_L("\"");
1360   }
1361   if (accesskey && *accesskey) {
1362     W_L(" accesskey=\"");
1363     W_V(accesskey);
1364     W_L("\"");
1365   }
1366   if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
1367     char *fmt = qs_conv_istyle_to_format(r,istyle);
1368     if (max_length && *max_length) {
1369       int ii;
1370       for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
1371         if (max_length[ii] < '0' || max_length[ii] > '9') {
1372           max_length = apr_psprintf(r->pool, "0");
1373           break;
1374         }
1375       }
1376
1377       if (strcmp(max_length, "0")) {
1378         char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(max_length), fmt);
1379         W_V(vv);
1380       }
1381     }
1382     else {
1383       W_L(" FORMAT=\"");
1384       W_L("*");
1385       W_V(fmt);
1386       W_L("\"");
1387     }
1388   }
1389   else {
1390     if (max_length && *max_length) {
1391       if (chxj_chk_numeric(max_length) != 0) {
1392         max_length = apr_psprintf(r->pool, "0");
1393       }
1394       if (strcmp(max_length, "0")) {
1395         char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(max_length));
1396         W_V(vv);
1397       }
1398     }
1399   }
1400   /*--------------------------------------------------------------------------*/
1401   /* The figure is default for the password.                                  */
1402   /*--------------------------------------------------------------------------*/
1403   if (type && (istyle == NULL || *istyle == 0) && STRCASEEQ('p','P',"password", type) && ! xhtml->entryp->pc_flag) {
1404     if (max_length) {
1405       W_L(" FORMAT=\"");
1406       W_V(max_length);
1407       W_L("N\"");
1408     }
1409     else {
1410       W_L(" FORMAT=\"*N\"");
1411     }
1412   }
1413   if (checked) {
1414     W_L(" checked=\"checked\"");
1415   }
1416   W_L(" />");
1417   return xhtml->out;
1418 }
1419
1420
1421 /**
1422  * It is a handler who processes the INPUT tag.
1423  *
1424  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1425  *                     destination is specified.
1426  * @param node   [i]   The INPUT tag node is specified.
1427  * @return The conversion result is returned.
1428  */
1429 static char *
1430 s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child)) 
1431 {
1432   xhtml_t *xhtml = GET_XHTML(pdoc);
1433
1434   return xhtml->out;
1435 }
1436
1437
1438 /**
1439  * It is a handler who processes the CENTER tag.
1440  *
1441  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1442  *                     destination is specified.
1443  * @param node   [i]   The CENTER tag node is specified.
1444  * @return The conversion result is returned.
1445  */
1446 static char *
1447 s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node)) 
1448 {
1449   xhtml_t *xhtml = GET_XHTML(pdoc);
1450   Doc     *doc   = xhtml->doc;
1451
1452   W_L("<center>");
1453   return xhtml->out;
1454 }
1455
1456
1457 /**
1458  * It is a handler who processes the CENTER tag.
1459  *
1460  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1461  *                     destination is specified.
1462  * @param node   [i]   The CENTER tag node is specified.
1463  * @return The conversion result is returned.
1464  */
1465 static char *
1466 s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child)) 
1467 {
1468   xhtml_t *xhtml = GET_XHTML(pdoc);
1469   Doc     *doc   = xhtml->doc;
1470
1471   W_L("</center>");
1472   return xhtml->out;
1473 }
1474
1475
1476 /**
1477  * It is a handler who processes the HR tag.
1478  *
1479  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1480  *                     destination is specified.
1481  * @param node   [i]   The HR tag node is specified.
1482  * @return The conversion result is returned.
1483  */
1484 static char *
1485 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
1486 {
1487   xhtml_t *xhtml = GET_XHTML(pdoc);
1488   Doc     *doc   = xhtml->doc;
1489   Attr    *attr;
1490
1491   W_L("<hr");
1492  
1493   for (attr = qs_get_attr(doc,node);
1494        attr; 
1495        attr = qs_get_next_attr(doc,attr)) {
1496     char *name = qs_get_attr_name(doc,attr);
1497     char *value = qs_get_attr_value(doc,attr);
1498     if (STRCASEEQ('a','A',"align", name)) {
1499       /*----------------------------------------------------------------------*/
1500       /* CHTML 1.0                                                            */
1501       /*----------------------------------------------------------------------*/
1502       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
1503         W_L(" align=\"");
1504         W_V(value);
1505         W_L("\"");
1506       }
1507     }
1508     else if (STRCASEEQ('s','S',"size", name)) {
1509       /*----------------------------------------------------------------------*/
1510       /* CHTML 1.0                                                            */
1511       /*----------------------------------------------------------------------*/
1512       if (value && *value) {
1513         W_L(" size=\"");
1514         W_V(value);
1515         W_L("\"");
1516       }
1517     }
1518     else if (STRCASEEQ('w','W',"width", name)) {
1519       /*----------------------------------------------------------------------*/
1520       /* CHTML 1.0                                                            */
1521       /*----------------------------------------------------------------------*/
1522       if (value && *value) {
1523         W_L(" width=\"");
1524         W_V(value);
1525         W_L("\"");
1526       }
1527     }
1528     else if (STRCASEEQ('n','N',"noshade", name)) {
1529       /*----------------------------------------------------------------------*/
1530       /* CHTML 1.0                                                            */
1531       /*----------------------------------------------------------------------*/
1532       /* ignore */
1533     }
1534     else if (STRCASEEQ('c','C',"color", name)) {
1535       /*----------------------------------------------------------------------*/
1536       /* CHTML 4.0                                                            */
1537       /*----------------------------------------------------------------------*/
1538       /* ignore */
1539     }
1540   }
1541   W_L(" />");
1542   return xhtml->out;
1543 }
1544
1545
1546 /**
1547  * It is a handler who processes the HR tag.
1548  *
1549  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1550  *                     destination is specified.
1551  * @param node   [i]   The HR tag node is specified.
1552  * @return The conversion result is returned.
1553  */
1554 static char *
1555 s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child)) 
1556 {
1557   xhtml_t *xhtml = GET_XHTML(pdoc);
1558
1559   return xhtml->out;
1560 }
1561
1562
1563 /**
1564  * It is a handler who processes the PRE tag.
1565  *
1566  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1567  *                     destination is specified.
1568  * @param node   [i]   The PRE tag node is specified.
1569  * @return The conversion result is returned.
1570  */
1571 static char *
1572 s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node)) 
1573 {
1574   xhtml_t *xhtml = GET_XHTML(pdoc);
1575   Doc     *doc   = xhtml->doc;
1576
1577   xhtml->pre_flag++;
1578   W_L("<pre>");
1579   return xhtml->out;
1580 }
1581
1582
1583 /**
1584  * It is a handler who processes the PRE tag.
1585  *
1586  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1587  *                     destination is specified.
1588  * @param node   [i]   The PRE tag node is specified.
1589  * @return The conversion result is returned.
1590  */
1591 static char *
1592 s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child)) 
1593 {
1594   xhtml_t *xhtml = GET_XHTML(pdoc);
1595   Doc     *doc   = xhtml->doc;
1596
1597   W_L("</pre>");
1598   xhtml->pre_flag--;
1599
1600   return xhtml->out;
1601 }
1602
1603
1604 /**
1605  * It is a handler who processes the P tag.
1606  *
1607  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1608  *                     destination is specified.
1609  * @param node   [i]   The P tag node is specified.
1610  * @return The conversion result is returned.
1611  */
1612 static char *
1613 s_xhtml_1_0_start_p_tag(void *pdoc, Node *node) 
1614 {
1615   xhtml_t *xhtml = GET_XHTML(pdoc);
1616   Doc     *doc   = xhtml->doc;
1617   Attr    *attr;
1618   char    *align = NULL;
1619
1620   W_L("<p");
1621   for (attr = qs_get_attr(doc,node);
1622        attr;
1623        attr = qs_get_next_attr(doc,attr)) {
1624     char *nm  = qs_get_attr_name(doc,attr);
1625     char *val = qs_get_attr_value(doc,attr);
1626     if (STRCASEEQ('a','A',"align", nm)) {
1627       /*----------------------------------------------------------------------*/
1628       /* CHTML 1.0 (W3C version 3.2)                                          */
1629       /*----------------------------------------------------------------------*/
1630       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1631         align = apr_pstrdup(doc->buf.pool, val);
1632         break;
1633       }
1634     }
1635   }
1636   if (align) {
1637     W_L(" align=\"");
1638     W_V(align);
1639     W_L("\"");
1640   }
1641   W_L(">");
1642   return xhtml->out;
1643 }
1644
1645
1646 /**
1647  * It is a handler who processes the P tag.
1648  *
1649  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1650  *                     destination is specified.
1651  * @param node   [i]   The P tag node is specified.
1652  * @return The conversion result is returned.
1653  */
1654 static char *
1655 s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child)) 
1656 {
1657   xhtml_t *xhtml = GET_XHTML(pdoc);
1658   Doc     *doc   = xhtml->doc;
1659
1660   W_L("</p>");
1661   return xhtml->out;
1662 }
1663
1664
1665 /**
1666  * It is a handler who processes the UL tag.
1667  *
1668  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1669  *                     destination is specified.
1670  * @param node   [i]   The UL tag node is specified.
1671  * @return The conversion result is returned.
1672  */
1673 static char *
1674 s_xhtml_1_0_start_ul_tag(void *pdoc, Node *UNUSED(node)) 
1675 {
1676   xhtml_t *xhtml = GET_XHTML(pdoc);
1677   Doc     *doc   = xhtml->doc;
1678
1679   W_L("<ul>");
1680   return xhtml->out;
1681 }
1682
1683
1684 /**
1685  * It is a handler who processes the UL tag.
1686  *
1687  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1688  *                     destination is specified.
1689  * @param node   [i]   The UL tag node is specified.
1690  * @return The conversion result is returned.
1691  */
1692 static char *
1693 s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child)) 
1694 {
1695   xhtml_t *xhtml = GET_XHTML(pdoc);
1696   Doc     *doc   = xhtml->doc;
1697
1698   W_L("</ul>");
1699   return xhtml->out;
1700 }
1701
1702
1703 /**
1704  * It is a handler who processes the H1 tag.
1705  *
1706  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1707  *                     destination is specified.
1708  * @param node   [i]   The H1 tag node is specified.
1709  * @return The conversion result is returned.
1710  */
1711 static char *
1712 s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node) 
1713 {
1714   xhtml_t *xhtml = GET_XHTML(pdoc);
1715   Doc     *doc   = xhtml->doc;
1716   Attr    *attr;
1717
1718   W_L("<h1");
1719   for (attr = qs_get_attr(doc,node);
1720        attr;
1721        attr = qs_get_next_attr(doc,attr)) {
1722     char* name;
1723     char* value;
1724     name  = qs_get_attr_name(doc,attr);
1725     value = qs_get_attr_value(doc,attr);
1726     if (STRCASEEQ('a','A',"align", name)) {
1727       if (value) {
1728         if (STRCASEEQ('l','L',"left",value)) {
1729           W_L(" style=\"");
1730           W_L("text-align:left");
1731           W_L("\"");
1732         }
1733         else if (STRCASEEQ('r','R',"right",value)) {
1734           W_L(" style=\"");
1735           W_L("text-align:right");
1736           W_L("\"");
1737         }
1738         else if (STRCASEEQ('c','C',"center",value)) {
1739           W_L(" style=\"");
1740           W_L("text-align:center");
1741           W_L("\"");
1742         }
1743         break;
1744       }
1745     }
1746   }
1747   W_L(">");
1748   return xhtml->out;
1749 }
1750
1751
1752 /**
1753  * It is a handler who processes the H1 tag.
1754  *
1755  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1756  *                     destination is specified.
1757  * @param node   [i]   The H1 tag node is specified.
1758  * @return The conversion result is returned.
1759  */
1760 static char *
1761 s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child)) 
1762 {
1763   xhtml_t *xhtml = GET_XHTML(pdoc);
1764   Doc     *doc   = xhtml->doc;
1765
1766   W_L("</h1>");
1767   return xhtml->out;
1768 }
1769
1770
1771 /**
1772  * It is a handler who processes the H2 tag.
1773  *
1774  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1775  *                     destination is specified.
1776  * @param node   [i]   The H2 tag node is specified.
1777  * @return The conversion result is returned.
1778  */
1779 static char *
1780 s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
1781 {
1782   xhtml_t *xhtml = GET_XHTML(pdoc);
1783   Doc     *doc = xhtml->doc;
1784   Attr    *attr;
1785
1786   W_L("<h2");
1787   for (attr = qs_get_attr(doc,node);
1788        attr;
1789        attr = qs_get_next_attr(doc,attr)) {
1790     char* name;
1791     char* value;
1792     name  = qs_get_attr_name(doc,attr);
1793     value = qs_get_attr_value(doc,attr);
1794     if (STRCASEEQ('a','A',"align", name)) {
1795       if (value) {
1796         if (STRCASEEQ('l','L',"left",value)) {
1797           W_L(" style=\"");
1798           W_L("text-align:left");
1799           W_L("\"");
1800         }
1801         else if (STRCASEEQ('r','R',"right",value)) {
1802           W_L(" style=\"");
1803           W_L("text-align:right");
1804           W_L("\"");
1805         }
1806         else if (STRCASEEQ('c','C',"center",value)) {
1807           W_L(" style=\"");
1808           W_L("text-align:center");
1809           W_L("\"");
1810         }
1811         break;
1812       }
1813     }
1814   }
1815   W_L(">");
1816   return xhtml->out;
1817 }
1818
1819
1820 /**
1821  * It is a handler who processes the H2 tag.
1822  *
1823  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1824  *                     destination is specified.
1825  * @param node   [i]   The H2 tag node is specified.
1826  * @return The conversion result is returned.
1827  */
1828 static char *
1829 s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child)) 
1830 {
1831   xhtml_t *xhtml = GET_XHTML(pdoc);
1832   Doc     *doc   = xhtml->doc;
1833
1834   W_L("</h2>");
1835   return xhtml->out;
1836 }
1837
1838
1839 /**
1840  * It is a handler who processes the H3 tag.
1841  *
1842  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1843  *                     destination is specified.
1844  * @param node   [i]   The H3 tag node is specified.
1845  * @return The conversion result is returned.
1846  */
1847 static char *
1848 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
1849 {
1850   xhtml_t *xhtml = GET_XHTML(pdoc);
1851   Doc     *doc   = xhtml->doc;
1852   Attr    *attr;
1853
1854   W_L("<h3");
1855   for (attr = qs_get_attr(doc,node);
1856        attr;
1857        attr = qs_get_next_attr(doc,attr)) {
1858     char* name;
1859     char* value;
1860     name  = qs_get_attr_name(doc,attr);
1861     value = qs_get_attr_value(doc,attr);
1862     if (STRCASEEQ('a','A',"align", name)) {
1863       if (value) {
1864         if (STRCASEEQ('l','L',"left",value)) {
1865           W_L(" style=\"");
1866           W_L("text-align:left");
1867           W_L("\"");
1868         }
1869         else if (STRCASEEQ('r','R',"right",value)) {
1870           W_L(" style=\"");
1871           W_L("text-align:right");
1872           W_L("\"");
1873         }
1874         else if (STRCASEEQ('c','C',"center",value)) {
1875           W_L(" style=\"");
1876           W_L("text-align:center");
1877           W_L("\"");
1878         }
1879         break;
1880       }
1881     }
1882   }
1883   W_L(">");
1884   return xhtml->out;
1885 }
1886
1887
1888 /**
1889  * It is a handler who processes the H3 tag.
1890  *
1891  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1892  *                     destination is specified.
1893  * @param node   [i]   The H3 tag node is specified.
1894  * @return The conversion result is returned.
1895  */
1896 static char *
1897 s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child)) 
1898 {
1899   xhtml_t *xhtml = GET_XHTML(pdoc);
1900   Doc     *doc   = xhtml->doc;
1901
1902   W_L("</h3>");
1903   return xhtml->out;
1904 }
1905
1906
1907 /**
1908  * It is a handler who processes the H4 tag.
1909  *
1910  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1911  *                     destination is specified.
1912  * @param node   [i]   The H4 tag node is specified.
1913  * @return The conversion result is returned.
1914  */
1915 static char *
1916 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
1917 {
1918   xhtml_t *xhtml = GET_XHTML(pdoc);
1919   Doc     *doc   = xhtml->doc;
1920   Attr    *attr;
1921
1922   W_L("<h4");
1923   for (attr = qs_get_attr(doc,node);
1924        attr;
1925        attr = qs_get_next_attr(doc,attr)) {
1926     char* name;
1927     char* value;
1928     name  = qs_get_attr_name(doc,attr);
1929     value = qs_get_attr_value(doc,attr);
1930     if (STRCASEEQ('a','A',"align", name)) {
1931       if (value) {
1932         if (STRCASEEQ('l','L',"left",value)) {
1933           W_L(" style=\"");
1934           W_L("text-align:left");
1935           W_L("\"");
1936         }
1937         else if (STRCASEEQ('r','R',"right",value)) {
1938           W_L(" style=\"");
1939           W_L("text-align:right");
1940           W_L("\"");
1941         }
1942         else if (STRCASEEQ('c','C',"center",value)) {
1943           W_L(" style=\"");
1944           W_L("text-align:center");
1945           W_L("\"");
1946         }
1947         break;
1948       }
1949     }
1950   }
1951   W_L(">");
1952   return xhtml->out;
1953 }
1954
1955
1956 /**
1957  * It is a handler who processes the H4 tag.
1958  *
1959  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1960  *                     destination is specified.
1961  * @param node   [i]   The H4 tag node is specified.
1962  * @return The conversion result is returned.
1963  */
1964 static char *
1965 s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child)) 
1966 {
1967   xhtml_t *xhtml = GET_XHTML(pdoc);
1968   Doc     *doc   = xhtml->doc;
1969
1970   W_L("</h4>");
1971   return xhtml->out;
1972 }
1973
1974
1975 /**
1976  * It is a handler who processes the H5 tag.
1977  *
1978  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
1979  *                     destination is specified.
1980  * @param node   [i]   The H5 tag node is specified.
1981  * @return The conversion result is returned.
1982  */
1983 static char *
1984 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
1985 {
1986   xhtml_t *xhtml = GET_XHTML(pdoc);
1987   Doc     *doc   = xhtml->doc;
1988   Attr    *attr;
1989
1990   W_L("<h5");
1991   for (attr = qs_get_attr(doc,node);
1992        attr;
1993        attr = qs_get_next_attr(doc,attr)) {
1994     char* name;
1995     char* value;
1996     name  = qs_get_attr_name(doc,attr);
1997     value = qs_get_attr_value(doc,attr);
1998     if (STRCASEEQ('a','A',"align", name)) {
1999       if (value) {
2000         if (STRCASEEQ('l','L',"left",value)) {
2001           W_L(" style=\"");
2002           W_L("text-align:left");
2003           W_L("\"");
2004         }
2005         else if (STRCASEEQ('r','R',"right",value)) {
2006           W_L(" style=\"");
2007           W_L("text-align:right");
2008           W_L("\"");
2009         }
2010         else if (STRCASEEQ('c','C',"center",value)) {
2011           W_L(" style=\"");
2012           W_L("text-align:center");
2013           W_L("\"");
2014         }
2015         break;
2016       }
2017     }
2018   }
2019   W_L(">");
2020   return xhtml->out;
2021 }
2022
2023
2024 /**
2025  * It is a handler who processes the H5 tag.
2026  *
2027  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2028  *                     destination is specified.
2029  * @param node   [i]   The H5 tag node is specified.
2030  * @return The conversion result is returned.
2031  */
2032 static char *
2033 s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child)) 
2034 {
2035   xhtml_t *xhtml = GET_XHTML(pdoc);
2036   Doc     *doc   = xhtml->doc;
2037
2038   W_L("</h5>");
2039   return xhtml->out;
2040 }
2041
2042
2043 /**
2044  * It is a handler who processes the H6 tag.
2045  *
2046  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2047  *                     destination is specified.
2048  * @param node   [i]   The H6 tag node is specified.
2049  * @return The conversion result is returned.
2050  */
2051 static char *
2052 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
2053 {
2054   xhtml_t *xhtml = GET_XHTML(pdoc);
2055   Doc     *doc   = xhtml->doc;
2056   Attr    *attr;
2057
2058   W_L("<h6");
2059   for (attr = qs_get_attr(doc,node);
2060        attr;
2061        attr = qs_get_next_attr(doc,attr)) {
2062     char* name;
2063     char* value;
2064     name  = qs_get_attr_name(doc,attr);
2065     value = qs_get_attr_value(doc,attr);
2066     if (STRCASEEQ('a','A',"align", name)) {
2067       if (value) {
2068         if (STRCASEEQ('l','L',"left",value)) {
2069           W_L(" style=\"");
2070           W_L("text-align:left");
2071           W_L("\"");
2072         }
2073         else if (STRCASEEQ('r','R',"right",value)) {
2074           W_L(" style=\"");
2075           W_L("text-align:right");
2076           W_L("\"");
2077         }
2078         else if (STRCASEEQ('c','C',"center",value)) {
2079           W_L(" style=\"");
2080           W_L("text-align:center");
2081           W_L("\"");
2082         }
2083         break;
2084       }
2085     }
2086   }
2087   W_L(">");
2088   return xhtml->out;
2089 }
2090
2091
2092 /**
2093  * It is a handler who processes the H6 tag.
2094  *
2095  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2096  *                     destination is specified.
2097  * @param node   [i]   The H6 tag node is specified.
2098  * @return The conversion result is returned.
2099  */
2100 static char *
2101 s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child)) 
2102 {
2103   xhtml_t *xhtml = GET_XHTML(pdoc);
2104   Doc     *doc   = xhtml->doc;
2105
2106   W_L("</h6>");
2107   return xhtml->out;
2108 }
2109
2110
2111 /**
2112  * It is a handler who processes the OL tag.
2113  *
2114  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2115  *                     destination is specified.
2116  * @param node   [i]   The OL tag node is specified.
2117  * @return The conversion result is returned.
2118  */
2119 static char *
2120 s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
2121 {
2122   xhtml_t *xhtml = GET_XHTML(pdoc);
2123   Doc     *doc   = xhtml->doc;
2124   Attr    *attr;
2125
2126   W_L("<ol");
2127   /*--------------------------------------------------------------------------*/
2128   /* Get Attributes                                                           */
2129   /*--------------------------------------------------------------------------*/
2130   for (attr = qs_get_attr(doc,node);
2131        attr;
2132        attr = qs_get_next_attr(doc,attr)) {
2133     char *name = qs_get_attr_name(doc,attr);
2134     char *value = qs_get_attr_value(doc,attr);
2135     if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2136       W_L(" type=\"");
2137       W_V(value);
2138       W_L("\"");
2139     }
2140     else if (STRCASEEQ('s','S',"start",name) && value && *value) {
2141       W_L(" start=\"");
2142       W_V(value);
2143       W_L("\"");
2144     }
2145   }
2146   W_L(">");
2147   return xhtml->out;
2148 }
2149
2150
2151 /**
2152  * It is a handler who processes the OL tag.
2153  *
2154  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2155  *                     destination is specified.
2156  * @param node   [i]   The OL tag node is specified.
2157  * @return The conversion result is returned.
2158  */
2159 static char *
2160 s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child)) 
2161 {
2162   xhtml_t *xhtml = GET_XHTML(pdoc);
2163   Doc     *doc   = xhtml->doc;
2164
2165   W_L("</ol>");
2166   return xhtml->out;
2167 }
2168
2169
2170 /**
2171  * It is a handler who processes the LI tag.
2172  *
2173  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2174  *                     destination is specified.
2175  * @param node   [i]   The LI tag node is specified.
2176  * @return The conversion result is returned.
2177  */
2178 static char *
2179 s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
2180 {
2181   xhtml_t *xhtml = GET_XHTML(pdoc);
2182   Doc     *doc   = xhtml->doc;
2183   Attr    *attr;
2184
2185   W_L("<li");
2186   /*--------------------------------------------------------------------------*/
2187   /* Get Attributes                                                           */
2188   /*--------------------------------------------------------------------------*/
2189   for (attr = qs_get_attr(doc,node);
2190        attr;
2191        attr = qs_get_next_attr(doc,attr)) {
2192     char *name = qs_get_attr_name(doc,attr);
2193     char *value = qs_get_attr_value(doc,attr);
2194     if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
2195       W_L(" type=\"");
2196       W_V(value);
2197       W_L("\"");
2198     }
2199     else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2200       W_L(" value=\"");
2201       W_V(value);
2202       W_L("\"");
2203     }
2204   }
2205   W_L(">");
2206   return xhtml->out;
2207 }
2208
2209
2210 /**
2211  ** It is a handler who processes the LI tag.
2212  *
2213  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2214  *                     destination is specified.
2215  * @param node   [i]   The LI tag node is specified.
2216  * @return The conversion result is returned.
2217  */
2218 static char *
2219 s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child)) 
2220 {
2221   xhtml_t *xhtml = GET_XHTML(pdoc);
2222   Doc     *doc   = xhtml->doc;
2223
2224   W_L("</li>");
2225   return xhtml->out;
2226 }
2227
2228 /**
2229  * It is a handler who processes the IMG tag.
2230  *
2231  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2232  *                     destination is specified.
2233  * @param node   [i]   The IMG tag node is specified.
2234  * @return The conversion result is returned.
2235  */
2236 static char *
2237 s_xhtml_1_0_start_img_tag(void *pdoc, Node *node) 
2238 {
2239   xhtml_t       *xhtml = GET_XHTML(pdoc);
2240   Doc           *doc   = xhtml->doc;
2241   request_rec   *r     = doc->r;
2242   Attr          *attr;
2243
2244 #ifndef IMG_NOT_CONVERT_FILENAME
2245   device_table  *spec = xhtml->spec;
2246 #endif
2247
2248   W_L("<img");
2249   /*--------------------------------------------------------------------------*/
2250   /* Get Attributes                                                           */
2251   /*--------------------------------------------------------------------------*/
2252   for (attr = qs_get_attr(doc,node);
2253        attr;
2254        attr = qs_get_next_attr(doc,attr)) {
2255     char *name  = qs_get_attr_name(doc,attr);
2256     char *value = qs_get_attr_value(doc,attr);
2257
2258     if (STRCASEEQ('s','S',"src",name)) {
2259       value = chxj_encoding_parameter(r, value);
2260 #ifdef IMG_NOT_CONVERT_FILENAME
2261
2262       W_L(" src=\"");
2263       W_V(value);
2264       W_L("\"");
2265
2266 #else
2267
2268       W_L(" src=\"");
2269       {
2270         char *vv = chxj_img_conv(r,spec,value);
2271         W_V(vv);
2272       }
2273       W_L("\"");
2274
2275 #endif
2276     }
2277     else 
2278     if (STRCASEEQ('a','A',"align",name)) {
2279       if (value && (STRCASEEQ('t','T',"top",   value) ||
2280                     STRCASEEQ('m','M',"middle",value) ||
2281                     STRCASEEQ('b','B',"bottom",value) ||
2282                     STRCASEEQ('l','L',"left",  value) ||
2283                     STRCASEEQ('r','R',"right", value))) {
2284         W_L(" align=\"");
2285         W_V(value);
2286         W_L("\"");
2287       }
2288     }
2289     else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2290       W_L(" alt=\"");
2291       W_V(value);
2292       W_L("\"");
2293     }
2294     else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2295       W_L(" width=\"");
2296       W_V(value);
2297       W_L("\"");
2298     }
2299     else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2300       W_L(" height=\"");
2301       W_V(value);
2302       W_L("\"");
2303     }
2304     else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
2305       W_L(" hspace=\"");
2306       W_V(value);
2307       W_L("\"");
2308     }
2309     else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
2310       W_L(" vspace=\"");
2311       W_V(value);
2312       W_L("\"");
2313     }
2314   }
2315   W_L(" />");
2316   return xhtml->out;
2317 }
2318
2319
2320 /**
2321  * It is a handler who processes the IMG tag.
2322  *
2323  * @param xhtml  [i/o] The pointer to the XHTML structure at the output
2324  *                     destination is specified.
2325  * @param node   [i]   The IMG tag node is specified.
2326  * @return The conversion result is returned.
2327  */
2328 static char *
2329 s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child)) 
2330 {
2331   xhtml_t *xhtml = GET_XHTML(pdoc);
2332
2333   return xhtml->out;
2334 }
2335
2336
2337 /**
2338  * It is a handler who processes the SELECT tag.
2339  *
2340  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2341  *                     destination is specified.
2342  * @param node   [i]   The SELECT tag node is specified.
2343  * @return The conversion result is returned.
2344  */
2345 static char *
2346 s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
2347 {
2348   xhtml_t *xhtml    = GET_XHTML(pdoc);
2349   Doc     *doc      = xhtml->doc;
2350   char    *size     = NULL;
2351   char    *name     = NULL;
2352   char    *multiple = NULL;
2353   Attr    *attr;
2354
2355
2356   W_L("<select");
2357   for (attr = qs_get_attr(doc,child);
2358        attr;
2359        attr = qs_get_next_attr(doc,attr)) {
2360     char *nm  = qs_get_attr_name(doc,attr);
2361     char *val = qs_get_attr_value(doc,attr);
2362     if (STRCASEEQ('s','S',"size",nm)) {
2363       /*----------------------------------------------------------------------*/
2364       /* CHTML 1.0 version 2.0                                                */
2365       /*----------------------------------------------------------------------*/
2366       size = apr_pstrdup(doc->buf.pool, val);
2367     }
2368     else if (STRCASEEQ('n','N',"name",nm)) {
2369       /*----------------------------------------------------------------------*/
2370       /* CHTML 1.0 version 2.0                                                */
2371       /*----------------------------------------------------------------------*/
2372       name = apr_pstrdup(doc->buf.pool, val);
2373     }
2374     else if (STRCASEEQ('m','M',"multiple",nm)) {
2375       /*----------------------------------------------------------------------*/
2376       /* CHTML 1.0 version 2.0                                                */
2377       /*----------------------------------------------------------------------*/
2378       multiple = apr_pstrdup(doc->buf.pool, val);
2379     }
2380   }
2381   if (size && *size) {
2382     W_L(" size=\"");
2383     W_V(size);
2384     W_L("\"");
2385   }
2386   if (name && *name) {
2387     W_L(" name=\"");
2388     W_V(name);
2389     W_L("\"");
2390   }
2391   if (multiple) {
2392     /* "true" is *NOT* W3C. it is specification of WAP2.0 for EZWEB */
2393     W_L(" multiple=\"true\"");
2394   }
2395   W_L(">\r\n");
2396   return xhtml->out;
2397 }
2398
2399
2400 /**
2401  * It is a handler who processes the SELECT tag.
2402  *
2403  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2404  *                     destination is specified.
2405  * @param node   [i]   The SELECT tag node is specified.
2406  * @return The conversion result is returned.
2407  */
2408 static char *
2409 s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
2410 {
2411   xhtml_t *xhtml = GET_XHTML(pdoc);
2412   Doc     *doc   = xhtml->doc;
2413
2414   W_L("</select>\r\n");
2415   return xhtml->out;
2416 }
2417
2418
2419 /**
2420  * It is a handler who processes the OPTION tag.
2421  *
2422  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2423  *                     destination is specified.
2424  * @param node   [i]   The OPTION tag node is specified.
2425  * @return The conversion result is returned.
2426  */
2427 static char *
2428 s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
2429 {
2430   xhtml_t *xhtml = GET_XHTML(pdoc);
2431   Doc     *doc   = xhtml->doc;
2432   Attr    *attr;
2433
2434   char *selected   = NULL;
2435   char *value      = NULL;
2436
2437   W_L("<option");
2438   for (attr = qs_get_attr(doc,child);
2439        attr;
2440        attr = qs_get_next_attr(doc,attr)) {
2441     char *nm  = qs_get_attr_name(doc,attr);
2442     char *val = qs_get_attr_value(doc,attr);
2443     if (STRCASEEQ('s','S',"selected",nm)) {
2444       /* CHTML version 2.0 */
2445       selected = apr_pstrdup(doc->buf.pool, val);
2446     }
2447     else if (STRCASEEQ('v','V',"value",nm)) {
2448       /* CHTML version 2.0 */
2449       value = apr_pstrdup(doc->buf.pool, val);
2450     }
2451   }
2452   if (value && *value) {
2453     W_L(" value=\"");
2454     W_V(value);
2455     W_L("\"");
2456   }
2457   if (selected) {
2458     W_L(" selected=\"selected\"");
2459   }
2460   W_L(">");
2461   return xhtml->out;
2462 }
2463
2464
2465 /**
2466  * It is a handler who processes the OPTION tag.
2467  *
2468  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2469  *                     destination is specified.
2470  * @param node   [i]   The OPTION tag node is specified.
2471  * @return The conversion result is returned.
2472  */
2473 static char *
2474 s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
2475 {
2476   xhtml_t *xhtml = GET_XHTML(pdoc);
2477   Doc     *doc   = xhtml->doc;
2478
2479   W_L("</option>\r\n");
2480   return xhtml->out;
2481 }
2482
2483
2484 /**
2485  * It is a handler who processes the DIV tag.
2486  *
2487  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2488  *                     destination is specified.
2489  * @param node   [i]   The DIV tag node is specified.
2490  * @return The conversion result is returned.
2491  */
2492 static char *
2493 s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
2494 {
2495   xhtml_t *xhtml = GET_XHTML(pdoc);
2496   Doc     *doc   = xhtml->doc;
2497   Attr    *attr;
2498   char    *align   = NULL;
2499
2500   W_L("<div");
2501   for (attr = qs_get_attr(doc,child);
2502        attr;
2503        attr = qs_get_next_attr(doc,attr)) {
2504     char *nm  = qs_get_attr_name(doc,attr);
2505     char *val = qs_get_attr_value(doc,attr);
2506     if (STRCASEEQ('a','A',"align",nm)) {
2507       /*=====================================================================*/
2508       /* CHTML version 3.2                                                   */
2509       /*=====================================================================*/
2510       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2511         align = apr_pstrdup(doc->buf.pool, val);
2512       }
2513     }
2514   }
2515   if (align) {
2516     W_L(" align=\"");
2517     W_V(align);
2518     W_L("\"");
2519   }
2520   W_L(">");
2521   return xhtml->out;
2522 }
2523
2524
2525 /**
2526  * It is a handler who processes the DIV tag.
2527  *
2528  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2529  *                     destination is specified.
2530  * @param node   [i]   The DIV tag node is specified.
2531  * @return The conversion result is returned.
2532  */
2533 static char *
2534 s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
2535 {
2536   xhtml_t *xhtml = GET_XHTML(pdoc);
2537   Doc     *doc   = xhtml->doc;
2538   W_L("</div>\r\n");
2539   return xhtml->out;
2540 }
2541
2542
2543 /**
2544  * It is a handler who processes the B tag.
2545  *
2546  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2547  *                     destination is specified.
2548  * @param node   [i]   The B tag node is specified.
2549  * @return The conversion result is returned.
2550  */
2551 static char *
2552 s_xhtml_1_0_start_b_tag(void *pdoc, Node *UNUSED(child))
2553 {
2554   xhtml_t *xhtml = GET_XHTML(pdoc);
2555   Doc     *doc   = xhtml->doc;
2556
2557   W_L("<div style=\"font-weight:bold\">");
2558   return xhtml->out;
2559 }
2560
2561
2562 /**
2563  * It is a handler who processes the B tag.
2564  *
2565  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2566  *                     destination is specified.
2567  * @param node   [i]   The B tag node is specified.
2568  * @return The conversion result is returned.
2569  */
2570 static char *
2571 s_xhtml_1_0_end_b_tag(void *pdoc, Node *UNUSED(child))
2572 {
2573   xhtml_t *xhtml = GET_XHTML(pdoc);
2574   Doc     *doc   = xhtml->doc;
2575
2576   W_L("</div>\n");
2577   return xhtml->out;
2578 }
2579
2580
2581 /**
2582  * It is a handler who processes the CHXJ:IF tag.
2583  *
2584  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2585  *                     destination is specified.
2586  * @param node   [i]   The CHXJ:IF tag node is specified.
2587  */
2588 static char *
2589 s_xhtml_1_0_chxjif_tag(void *pdoc, Node *node)
2590 {
2591   xhtml_t      *xhtml = GET_XHTML(pdoc);
2592   Doc          *doc   = xhtml->doc;
2593   Node         *child;
2594
2595   for (child = qs_get_child_node(doc, node);
2596        child;
2597        child = qs_get_next_node(doc, child)) {
2598     W_V(child->otext);
2599     s_xhtml_1_0_chxjif_tag(xhtml, child);
2600   }
2601
2602   return NULL;
2603 }
2604
2605
2606 /**
2607  * It is a handler who processes the TEXTARE tag.
2608  *
2609  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2610  *                     destination is specified.
2611  * @param node   [i]   The TEXTAREA tag node is specified.
2612  * @return The conversion result is returned.
2613  */
2614 static char *
2615 s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node) 
2616 {
2617   xhtml_t *xhtml = GET_XHTML(pdoc);
2618   Doc     *doc   = xhtml->doc;
2619   Attr    *attr;
2620
2621   xhtml->textarea_flag++;
2622   W_L("<textarea");
2623   for (attr = qs_get_attr(doc,node);
2624        attr;
2625        attr = qs_get_next_attr(doc,attr)) {
2626     char *name  = qs_get_attr_name(doc,attr);
2627     char *value = qs_get_attr_value(doc,attr);
2628     if (STRCASEEQ('n','N',"name",name) && value && *value) {
2629       W_L(" name=\"");
2630       W_V(value);
2631       W_L("\"");
2632     }
2633     else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
2634       W_L(" rows=\"");
2635       W_V(value);
2636       W_L("\"");
2637     }
2638     else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
2639       W_L(" cols=\"");
2640       W_V(value);
2641       W_L("\"");
2642     }
2643     else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
2644       char *fmt = qs_conv_istyle_to_format(doc->r,value);
2645       W_L(" FORMAT=\"*");
2646       W_V(fmt);
2647       W_L("\"");
2648     }
2649     else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
2650       W_L(" accesskey=\"");
2651       W_V(value);
2652       W_L("\"");
2653     }
2654   }
2655   W_L(">\r\n");
2656   return xhtml->out;
2657 }
2658
2659
2660 /**
2661  * It is a handler who processes the TEXTAREA tag.
2662  *
2663  * @param pdoc  [i/o] The pointer to the CHTML structure at the output
2664  *                     destination is specified.
2665  * @param node   [i]   The TEXTAREA tag node is specified.
2666  * @return The conversion result is returned.
2667  */
2668 static char *
2669 s_xhtml_1_0_end_textarea_tag(void *pdoc, Node *UNUSED(child)) 
2670 {
2671   xhtml_t *xhtml = GET_XHTML(pdoc);
2672   Doc     *doc   = xhtml->doc;
2673
2674   W_L("</textarea>\r\n");
2675   xhtml->textarea_flag--;
2676
2677   return xhtml->out;
2678 }
2679
2680 static char *
2681 s_xhtml_1_0_text_tag(void *pdoc, Node *child)
2682 {
2683   xhtml_t     *xhtml   = GET_XHTML(pdoc);
2684   Doc         *doc     = xhtml->doc;
2685   request_rec *r       = doc->r;
2686   char        *textval;
2687   char        *tmp;
2688   char        *tdst;
2689   char        one_byte[2];
2690   int         ii;
2691   int         tdst_len;
2692   
2693   textval = qs_get_node_value(doc,child);
2694   if (strlen(textval) == 0) {
2695     return xhtml->out;
2696   }
2697   
2698   tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2699   memset(tmp, 0, qs_get_node_size(doc,child)+1);
2700   
2701   tdst     = qs_alloc_zero_byte_string(r);
2702   memset(one_byte, 0, sizeof(one_byte));
2703   tdst_len = 0;
2704   
2705   for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2706     char *out;
2707     int rtn = s_xhtml_search_emoji(xhtml, &textval[ii], &out);
2708     if (rtn != 0) {
2709       DBG(r,"[%s][%d]", out, rtn);
2710       tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2711       ii+=(rtn - 1);
2712       continue;
2713     }
2714     if (is_sjis_kanji(textval[ii])) {
2715       one_byte[0] = textval[ii+0];
2716       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2717       one_byte[0] = textval[ii+1];
2718       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2719       ii++;
2720     }
2721     else if (xhtml->pre_flag) {
2722       one_byte[0] = textval[ii+0];
2723       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2724     }
2725     else if (xhtml->textarea_flag) {
2726       one_byte[0] = textval[ii+0];
2727       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2728     }
2729     else if (textval[ii] != '\r' && textval[ii] != '\n') {
2730       one_byte[0] = textval[ii+0];
2731       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2732     }
2733   }
2734   W_V(tdst);
2735   return xhtml->out;
2736 }
2737
2738
2739 /**
2740  * It is a handler who processes the BLOCKQUOTE tag.
2741  *
2742  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2743  *                     destination is specified.
2744  * @param node   [i]   The BLOCKQUOTE tag node is specified.
2745  * @return The conversion result is returned.
2746  */
2747 static char *
2748 s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
2749 {
2750   xhtml_t *xhtml = GET_XHTML(pdoc);
2751   Doc     *doc   = xhtml->doc;
2752   W_L("<blockquote>");
2753   return xhtml->out;
2754 }
2755
2756
2757 /**
2758  * It is a handler who processes the BLOCKQUOTE tag.
2759  *
2760  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2761  *                     destination is specified.
2762  * @param node   [i]   The BLOCKQUOTE tag node is specified.
2763  * @return The conversion result is returned.
2764  */
2765 static char *
2766 s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
2767 {
2768   xhtml_t *xhtml = GET_XHTML(pdoc);
2769   Doc     *doc   = xhtml->doc;
2770   W_L("</blockquote>");
2771   return xhtml->out;
2772 }
2773
2774
2775 /**
2776  * It is a handler who processes the DIR tag.
2777  *
2778  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2779  *                     destination is specified.
2780  * @param node   [i]   The DIR tag node is specified.
2781  * @return The conversion result is returned.
2782  */
2783 static char *
2784 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *UNUSED(child))
2785 {
2786   xhtml_t *xhtml = GET_XHTML(pdoc);
2787   Doc     *doc = xhtml->doc;
2788   W_L("<dir>");
2789   return xhtml->out;
2790 }
2791
2792
2793 /**
2794  * It is a handler who processes the DIR tag.
2795  *
2796  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2797  *                     destination is specified.
2798  * @param node   [i]   The DIR tag node is specified.
2799  * @return The conversion result is returned.
2800  */
2801 static char *
2802 s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
2803 {
2804   xhtml_t *xhtml = GET_XHTML(pdoc);
2805   Doc     *doc = xhtml->doc;
2806   W_L("</dir>");
2807   return xhtml->out;
2808 }
2809
2810
2811 /**
2812  * It is a handler who processes the DL tag.
2813  *
2814  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2815  *                     destination is specified.
2816  * @param node   [i]   The DL tag node is specified.
2817  * @return The conversion result is returned.
2818  */
2819 static char *
2820 s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
2821 {
2822   xhtml_t *xhtml = GET_XHTML(pdoc);
2823   Doc *doc = xhtml->doc;
2824   W_L("<dl>");
2825   return xhtml->out;
2826 }
2827
2828
2829 /**
2830  * It is a handler who processes the DL tag.
2831  *
2832  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2833  *                     destination is specified.
2834  * @param node   [i]   The DL tag node is specified.
2835  * @return The conversion result is returned.
2836  */
2837 static char *
2838 s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
2839 {
2840   xhtml_t *xhtml = GET_XHTML(pdoc);
2841   Doc *doc = xhtml->doc;
2842   W_L("</dl>");
2843   return xhtml->out;
2844 }
2845
2846
2847 /**
2848  * It is a handter who processes the DT tag.
2849  *
2850  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2851  *                     destination is specified.
2852  * @param node   [i]   The DT tag node is specified.
2853  * @return The conversion result is returned.
2854  */
2855 static char *
2856 s_xhtml_1_0_start_dt_tag(void *pdoc, Node *UNUSED(child))
2857 {
2858   xhtml_t *xhtml = GET_XHTML(pdoc);
2859   Doc     *doc   = xhtml->doc;
2860   W_L("<dt>");
2861   return xhtml->out;
2862 }
2863
2864
2865 /**
2866  * It is a handter who processes the DT tag.
2867  *
2868  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2869  *                     destination is specified.
2870  * @param node   [i]   The DT tag node is specified.
2871  * @return The conversion result is returned.
2872  */
2873 static char *
2874 s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
2875 {
2876   xhtml_t *xhtml = GET_XHTML(pdoc);
2877   Doc     *doc   = xhtml->doc;
2878   W_L("</dt>");
2879   return xhtml->out;
2880 }
2881
2882
2883 /**
2884  * It is a handder who processes the DD tag.
2885  *
2886  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2887  *                     destination is specified.
2888  * @param node   [i]   The DD tag node is specified.
2889  * @return The conversion result is returned.
2890  */
2891 static char *
2892 s_xhtml_1_0_start_dd_tag(void *pdoc, Node *UNUSED(child))
2893 {
2894   xhtml_t *xhtml = GET_XHTML(pdoc);
2895   Doc     *doc   = xhtml->doc;
2896   W_L("<dd>");
2897   return xhtml->out;
2898 }
2899
2900
2901 /**
2902  * It is a handder who processes the DD tag.
2903  *
2904  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2905  *                     destination is specified.
2906  * @param node   [i]   The DD tag node is specified.
2907  * @return The conversion result is returned.
2908  */
2909 static char *
2910 s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
2911 {
2912   xhtml_t *xhtml = GET_XHTML(pdoc);
2913   Doc     *doc   = xhtml->doc;
2914   W_L("</dd>");
2915   return xhtml->out;
2916 }
2917
2918
2919 /**
2920  * It is a handler who processes the MENU tag.
2921  *
2922  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2923  *                     destination is specified.
2924  * @param node   [i]   The MENU tag node is specified.
2925  * @return The conversion result is returned.
2926  */
2927 static char *
2928 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *UNUSED(child))
2929 {
2930   xhtml_t *xhtml;
2931   Doc *doc;
2932   xhtml = GET_XHTML(pdoc);
2933   doc     = xhtml->doc;
2934   W_L("<menu>");
2935   return xhtml->out;
2936 }
2937
2938
2939 /**
2940  * It is a hanmenuer who processes the MENU tag.
2941  *
2942  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2943  *                     destination is specified.
2944  * @param node   [i]   The MENU tag node is specified.
2945  * @return The conversion result is returned.
2946  */
2947 static char *
2948 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
2949 {
2950   xhtml_t *xhtml = GET_XHTML(pdoc);
2951   Doc *doc = xhtml->doc;
2952   W_L("</menu>");
2953   return xhtml->out;
2954 }
2955
2956
2957 /**
2958  * It is a handler who processes the PLAINTEXT tag.
2959  *
2960  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2961  *                     destination is specified.
2962  * @param node   [i]   The PLAINTEXT tag node is specified.
2963  * @return The conversion result is returned.
2964  */
2965 static char *
2966 s_xhtml_1_0_start_plaintext_tag(void *pdoc, Node *node)
2967 {
2968   xhtml_t *xhtml = GET_XHTML(pdoc);
2969   Doc     *doc     = xhtml->doc;
2970   W_L("<plaintext>");
2971   s_xhtml_1_0_start_plaintext_tag_inner(pdoc,node);
2972   return xhtml->out;
2973 }
2974
2975 static char *
2976 s_xhtml_1_0_start_plaintext_tag_inner(void *pdoc, Node *node)
2977 {
2978   xhtml_t *xhtml = GET_XHTML(pdoc);
2979   Doc     *doc     = xhtml->doc;
2980   Node    *child;
2981   for (child = qs_get_child_node(doc, node);
2982        child;
2983        child = qs_get_next_node(doc, child)) {
2984     W_V(child->otext);
2985     s_xhtml_1_0_start_plaintext_tag_inner(pdoc, child);
2986   }
2987   return xhtml->out;
2988 }
2989
2990
2991 /**
2992  * It is a handler who processes the PLAINTEXT tag.
2993  *
2994  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
2995  *                     destination is specified.
2996  * @param node   [i]   The PLAINTEXT tag node is specified.
2997  * @return The conversion result is returned.
2998  */
2999 static char *
3000 s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
3001 {
3002   xhtml_t *xhtml = GET_XHTML(pdoc);
3003   Doc     *doc     = xhtml->doc;
3004   W_L("</plaintext>");
3005   return xhtml->out;
3006 }
3007
3008
3009 /**
3010  * It is a hanblinker who processes the BLINK tag.
3011  *
3012  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
3013  *                     destination is specified.
3014  * @param node   [i]   The BLINK tag node is specified.
3015  * @return The conversion result is returned.
3016  */
3017 static char *
3018 s_xhtml_1_0_start_blink_tag(void *pdoc, Node *UNUSED(child))
3019 {
3020   xhtml_t *xhtml = GET_XHTML(pdoc);
3021   Doc     *doc = xhtml->doc;
3022   W_L("<blink>");
3023   return xhtml->out;
3024 }
3025
3026
3027 /**
3028  * It is a hanblinker who processes the BLINK tag.
3029  *
3030  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
3031  *                     destination is specified.
3032  * @param node   [i]   The BLINK tag node is specified.
3033  * @return The conversion result is returned.
3034  */
3035 static char *
3036 s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(child))
3037 {
3038   xhtml_t *xhtml = GET_XHTML(pdoc);
3039   Doc     *doc = xhtml->doc;
3040   W_L("</blink>");
3041   return xhtml->out;
3042 }
3043
3044
3045 /**
3046  * It is a handler who processes the MARQUEE tag.
3047  *
3048  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
3049  *                     destination is specified.
3050  * @param node   [i]   The MARQUEE tag node is specified.
3051  * @return The conversion result is returned.
3052  */
3053 static char *
3054 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
3055 {
3056   xhtml_t *xhtml = GET_XHTML(pdoc);
3057   Doc     *doc = xhtml->doc;
3058   Attr *attr;
3059   W_L("<marquee");
3060   /*--------------------------------------------------------------------------*/
3061   /* Get Attributes                                                           */
3062   /*--------------------------------------------------------------------------*/
3063   for (attr = qs_get_attr(doc,node);
3064        attr;
3065        attr = qs_get_next_attr(doc,attr)) {
3066     char *name   = qs_get_attr_name(doc,attr);
3067     char *value  = qs_get_attr_value(doc,attr);
3068     if (STRCASEEQ('d','D',"direction", name)) {
3069       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
3070         W_L(" direction=\"");
3071         W_V(value);
3072         W_L("\"");
3073       }
3074     }
3075     else if (STRCASEEQ('b','B',"behavior",name)) {
3076       if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
3077         W_L(" behavior=\""); 
3078         W_V(value);
3079         W_L("\"");
3080       }
3081     }
3082     else if (STRCASEEQ('l','L',"loop",name)) {
3083       if (value && *value) {
3084         W_L(" loop=\"");
3085         W_V(value);
3086         W_L("\"");
3087       }
3088     }
3089   }
3090   W_L(">");
3091   return xhtml->out;
3092 }
3093
3094
3095 /**
3096  * It is a handler who processes the MARQUEE tag.
3097  *
3098  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
3099  *                     destination is specified.
3100  * @param node   [i]   The MARQUEE tag node is specified.
3101  * @return The conversion result is returned.
3102  */
3103 static char *
3104 s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
3105 {
3106   xhtml_t *xhtml = GET_XHTML(pdoc);
3107   Doc     *doc = xhtml->doc;
3108   W_L("</marquee>");
3109   return xhtml->out;
3110 }
3111 /*
3112  * vim:ts=2 et
3113  */