2 * Copyright (C) 2005-2009 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno All rights reserved.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 tag_handlers chxj_tag_handlers[] = {
21 .type = CHXJ_SPEC_UNKNOWN,
25 .type = CHXJ_SPEC_Chtml_1_0,
26 .handler = chtml10_handler,
29 .type = CHXJ_SPEC_Chtml_2_0,
30 .handler = chtml20_handler,
33 .type = CHXJ_SPEC_Chtml_3_0,
34 .handler = chtml30_handler,
37 .type = CHXJ_SPEC_Chtml_4_0,
38 .handler = chtml40_handler,
41 .type = CHXJ_SPEC_Chtml_5_0,
42 .handler = chtml50_handler,
45 .type = CHXJ_SPEC_Chtml_6_0,
46 .handler = ixhtml10_handler,
49 .type = CHXJ_SPEC_Chtml_7_0,
50 .handler = ixhtml10_handler,
53 .type = CHXJ_SPEC_XHtml_Mobile_1_0,
54 .handler = xhtml_handler,
57 .type = CHXJ_SPEC_Hdml,
58 .handler = hdml_handler,
61 .type = CHXJ_SPEC_Jhtml,
62 .handler = jhtml_handler,
65 .type = CHXJ_SPEC_Jxhtml,
66 .handler = jxhtml_handler,
69 .type = CHXJ_SPEC_HTML,
76 * It is main processing of conversion from CHTML to XXML.
80 * @param pdoc [i/o] The pointer to the XXML structure is specified.
81 * @param doc [i/o] The pointer to the XXML structure is specified.
82 * @param node [i] The pointer to a current node is specified.
83 * @param indent [i] The depth of the node processing it now is specified.
85 * @return The character string after it converts it is returned.
98 tag_handler *handlers;
101 handlers = chxj_tag_handlers[spec->html_spec_type].handler;
103 /*--------------------------------------------------------------------------*/
104 /* It is the main loop of the conversion processing. */
105 /*--------------------------------------------------------------------------*/
106 for (child = qs_get_child_node(doc,node);
108 child = qs_get_next_node(doc,child)) {
109 char *name = qs_get_node_name(doc,child);
113 /*----------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------*/
116 if (strcasecmp(name, "html") == 0) {
117 if (handlers[tagHTML].start_tag_handler)
118 handlers[tagHTML].start_tag_handler(pdoc, child);
120 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
122 if (handlers[tagHTML].end_tag_handler)
123 handlers[tagHTML].end_tag_handler(pdoc, child);
125 /*----------------------------------------------------------------------*/
127 /*----------------------------------------------------------------------*/
129 if (strcasecmp(name, "head") == 0) {
130 if (handlers[tagHEAD].start_tag_handler)
131 handlers[tagHEAD].start_tag_handler(pdoc, child);
133 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
135 if (handlers[tagHEAD].end_tag_handler)
136 handlers[tagHEAD].end_tag_handler(pdoc, child);
138 /*----------------------------------------------------------------------*/
140 /*----------------------------------------------------------------------*/
142 if (strcasecmp(name, "hr") == 0) {
143 if (handlers[tagHR].start_tag_handler)
144 handlers[tagHR].start_tag_handler(pdoc, child);
146 if (handlers[tagHR].end_tag_handler)
147 handlers[tagHR].end_tag_handler(pdoc, child);
149 /*----------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------*/
153 if (strcasecmp(name, "h1") == 0) {
154 if (handlers[tagH1].start_tag_handler)
155 handlers[tagH1].start_tag_handler(pdoc, child);
157 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
159 if (handlers[tagH1].end_tag_handler)
160 handlers[tagH1].end_tag_handler(pdoc, child);
162 /*----------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------*/
166 if (strcasecmp(name, "h2") == 0) {
167 if (handlers[tagH2].start_tag_handler)
168 handlers[tagH2].start_tag_handler(pdoc, child);
170 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
172 if (handlers[tagH2].end_tag_handler)
173 handlers[tagH2].end_tag_handler(pdoc, child);
175 /*----------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------*/
179 if (strcasecmp(name, "h3") == 0) {
180 if (handlers[tagH3].start_tag_handler)
181 handlers[tagH3].start_tag_handler(pdoc, child);
183 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
185 if (handlers[tagH3].end_tag_handler)
186 handlers[tagH3].end_tag_handler(pdoc, child);
188 /*----------------------------------------------------------------------*/
190 /*----------------------------------------------------------------------*/
192 if (strcasecmp(name, "h4") == 0) {
193 if (handlers[tagH4].start_tag_handler)
194 handlers[tagH4].start_tag_handler(pdoc, child);
196 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
198 if (handlers[tagH4].end_tag_handler)
199 handlers[tagH4].end_tag_handler(pdoc, child);
201 /*----------------------------------------------------------------------*/
203 /*----------------------------------------------------------------------*/
205 if (strcasecmp(name, "h5") == 0) {
206 if (handlers[tagH5].start_tag_handler)
207 handlers[tagH5].start_tag_handler(pdoc, child);
209 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
211 if (handlers[tagH5].end_tag_handler)
212 handlers[tagH5].end_tag_handler(pdoc, child);
214 /*----------------------------------------------------------------------*/
216 /*----------------------------------------------------------------------*/
218 if (strcasecmp(name, "h6") == 0) {
219 if (handlers[tagH6].start_tag_handler)
220 handlers[tagH6].start_tag_handler(pdoc, child);
222 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
224 if (handlers[tagH6].end_tag_handler)
225 handlers[tagH6].end_tag_handler(pdoc, child);
228 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
235 /*----------------------------------------------------------------------*/
237 /*----------------------------------------------------------------------*/
238 if (strcasecmp(name, "p") == 0) {
239 if (handlers[tagP].start_tag_handler)
240 handlers[tagP].start_tag_handler(pdoc, child);
242 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
244 if (handlers[tagP].end_tag_handler)
245 handlers[tagP].end_tag_handler(pdoc, child);
247 /*----------------------------------------------------------------------*/
249 /*----------------------------------------------------------------------*/
250 else if (strcasecmp(name, "pre") == 0) {
251 if (handlers[tagPRE].start_tag_handler)
252 handlers[tagPRE].start_tag_handler(pdoc, child);
254 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
256 if (handlers[tagPRE].end_tag_handler)
257 handlers[tagPRE].end_tag_handler(pdoc, child);
259 /*----------------------------------------------------------------------*/
261 /*----------------------------------------------------------------------*/
262 else if (strcasecmp(name, "plaintext") == 0) {
263 if (handlers[tagPLAINTEXT].start_tag_handler)
264 handlers[tagPLAINTEXT].start_tag_handler(pdoc, child);
266 if (handlers[tagPLAINTEXT].end_tag_handler)
267 handlers[tagPLAINTEXT].end_tag_handler(pdoc, child);
269 /*----------------------------------------------------------------------*/
271 /*----------------------------------------------------------------------*/
272 else if (strcasecmp(name, "param") == 0) {
273 /* ignore param tag block. */
276 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
282 /*----------------------------------------------------------------------*/
284 /*----------------------------------------------------------------------*/
285 if (strcasecmp(name, "nobr") == 0) {
286 if (handlers[tagNOBR].start_tag_handler)
287 handlers[tagNOBR].start_tag_handler(pdoc, child);
289 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
291 if (handlers[tagNOBR].end_tag_handler)
292 handlers[tagNOBR].end_tag_handler(pdoc, child);
295 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
301 /*----------------------------------------------------------------------*/
303 /*----------------------------------------------------------------------*/
304 if (strcasecmp(name, "ul") == 0) {
305 if (handlers[tagUL].start_tag_handler)
306 handlers[tagUL].start_tag_handler(pdoc, child);
308 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
310 if (handlers[tagUL].end_tag_handler)
311 handlers[tagUL].end_tag_handler(pdoc, child);
314 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
320 /*----------------------------------------------------------------------*/
322 /*----------------------------------------------------------------------*/
323 if (strcasecmp(name, "li") == 0) {
324 if (handlers[tagLI].start_tag_handler)
325 handlers[tagLI].start_tag_handler(pdoc, child);
327 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
329 if (handlers[tagLI].end_tag_handler)
330 handlers[tagLI].end_tag_handler(pdoc, child);
333 /*----------------------------------------------------------------------*/
335 /*----------------------------------------------------------------------*/
336 if (strcasecmp(name, "legend") == 0) {
337 if (handlers[tagLEGEND].start_tag_handler)
338 handlers[tagLEGEND].start_tag_handler(pdoc, child);
340 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
342 if (handlers[tagLEGEND].end_tag_handler)
343 handlers[tagLEGEND].end_tag_handler(pdoc, child);
346 /*----------------------------------------------------------------------*/
348 /*----------------------------------------------------------------------*/
349 if (strcasecmp(name, "label") == 0) {
350 if (handlers[tagLABEL].start_tag_handler)
351 handlers[tagLABEL].start_tag_handler(pdoc, child);
353 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
355 if (handlers[tagLABEL].end_tag_handler)
356 handlers[tagLABEL].end_tag_handler(pdoc, child);
359 /*----------------------------------------------------------------------*/
361 /*----------------------------------------------------------------------*/
362 if (strcasecmp(name, "link") == 0) {
363 if (handlers[tagLINK].start_tag_handler)
364 handlers[tagLINK].start_tag_handler(pdoc, child);
366 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
368 if (handlers[tagLINK].end_tag_handler)
369 handlers[tagLINK].end_tag_handler(pdoc, child);
372 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
379 /*----------------------------------------------------------------------*/
381 /*----------------------------------------------------------------------*/
382 if (strcasecmp(name, "ol") == 0) {
383 if (handlers[tagOL].start_tag_handler)
384 handlers[tagOL].start_tag_handler(pdoc, child);
386 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
388 if (handlers[tagOL].end_tag_handler)
389 handlers[tagOL].end_tag_handler(pdoc, child);
392 /*----------------------------------------------------------------------*/
394 /*----------------------------------------------------------------------*/
395 if (strcasecmp(name, "option") == 0) {
396 if (handlers[tagOPTION].start_tag_handler)
397 handlers[tagOPTION].start_tag_handler(pdoc, child);
399 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
401 if (handlers[tagOPTION].end_tag_handler)
402 handlers[tagOPTION].end_tag_handler(pdoc, child);
405 /*----------------------------------------------------------------------*/
407 /*----------------------------------------------------------------------*/
408 if (strcasecmp(name, "object") == 0) {
409 /* ignore object block */
412 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
419 /*----------------------------------------------------------------------*/
421 /*----------------------------------------------------------------------*/
422 if (strcasecmp(name, "meta") == 0) {
423 if (handlers[tagMETA].start_tag_handler)
424 handlers[tagMETA].start_tag_handler(pdoc, child);
426 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
428 if (handlers[tagMETA].end_tag_handler)
429 handlers[tagMETA].end_tag_handler(pdoc, child);
431 /*----------------------------------------------------------------------*/
433 /*----------------------------------------------------------------------*/
434 else if (strcasecmp(name, "menu") == 0) {
435 if (handlers[tagMENU].start_tag_handler)
436 handlers[tagMENU].start_tag_handler(pdoc, child);
438 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
440 if (handlers[tagMENU].end_tag_handler)
441 handlers[tagMENU].end_tag_handler(pdoc, child);
443 /*----------------------------------------------------------------------*/
445 /*----------------------------------------------------------------------*/
446 else if (strcasecmp(name, "marquee") == 0) {
447 if (handlers[tagMARQUEE].start_tag_handler)
448 handlers[tagMARQUEE].start_tag_handler(pdoc, child);
450 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
452 if (handlers[tagMARQUEE].end_tag_handler)
453 handlers[tagMARQUEE].end_tag_handler(pdoc, child);
456 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
462 /*----------------------------------------------------------------------*/
464 /*----------------------------------------------------------------------*/
465 if (strlen(name) == 1) {
466 if (handlers[tagB].start_tag_handler)
467 handlers[tagB].start_tag_handler(pdoc, child);
469 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
471 if (handlers[tagB].end_tag_handler)
472 handlers[tagB].end_tag_handler(pdoc, child);
475 /*----------------------------------------------------------------------*/
477 /*----------------------------------------------------------------------*/
478 if (strcasecmp(name, "base") == 0) {
479 if (handlers[tagBASE].start_tag_handler)
480 handlers[tagBASE].start_tag_handler(pdoc, child);
482 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
484 if (handlers[tagBASE].end_tag_handler)
485 handlers[tagBASE].end_tag_handler(pdoc, child);
487 /*----------------------------------------------------------------------*/
489 /*----------------------------------------------------------------------*/
491 if (strcasecmp(name, "body") == 0) {
492 if (handlers[tagBODY].start_tag_handler)
493 handlers[tagBODY].start_tag_handler(pdoc, child);
495 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
497 if (handlers[tagBODY].end_tag_handler)
498 handlers[tagBODY].end_tag_handler(pdoc, child);
500 /*----------------------------------------------------------------------*/
502 /*----------------------------------------------------------------------*/
503 else if (strcasecmp(name, "br") == 0) {
504 if (handlers[tagBR].start_tag_handler)
505 handlers[tagBR].start_tag_handler(pdoc, child);
507 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
509 if (handlers[tagBR].end_tag_handler)
510 handlers[tagBR].end_tag_handler(pdoc, child);
512 /*----------------------------------------------------------------------*/
514 /*----------------------------------------------------------------------*/
515 else if (strcasecmp(name, "blockquote") == 0) {
516 if (handlers[tagBLOCKQUOTE].start_tag_handler)
517 handlers[tagBLOCKQUOTE].start_tag_handler(pdoc, child);
519 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
521 if (handlers[tagBLOCKQUOTE].end_tag_handler)
522 handlers[tagBLOCKQUOTE].end_tag_handler(pdoc, child);
524 /*----------------------------------------------------------------------*/
526 /*----------------------------------------------------------------------*/
527 else if (strcasecmp(name, "blink") == 0) {
528 if (handlers[tagBLINK].start_tag_handler)
529 handlers[tagBLINK].start_tag_handler(pdoc, child);
531 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
533 if (handlers[tagBLINK].end_tag_handler)
534 handlers[tagBLINK].end_tag_handler(pdoc, child);
537 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
543 /*----------------------------------------------------------------------*/
545 /*----------------------------------------------------------------------*/
546 if (strcasecmp(name, "a") == 0) {
547 if (handlers[tagA].start_tag_handler)
548 handlers[tagA].start_tag_handler(pdoc, child);
550 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
552 if (handlers[tagA].end_tag_handler)
553 handlers[tagA].end_tag_handler(pdoc, child);
556 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
562 /*----------------------------------------------------------------------*/
564 /*----------------------------------------------------------------------*/
565 if (strcasecmp(name, "font") == 0) {
566 if (handlers[tagFONT].start_tag_handler)
567 handlers[tagFONT].start_tag_handler(pdoc, child);
569 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
571 if (handlers[tagFONT].end_tag_handler)
572 handlers[tagFONT].end_tag_handler(pdoc, child);
574 /*----------------------------------------------------------------------*/
576 /*----------------------------------------------------------------------*/
578 if (strcasecmp(name, "form") == 0) {
579 if (handlers[tagFORM].start_tag_handler)
580 handlers[tagFORM].start_tag_handler(pdoc, child);
582 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
584 if (handlers[tagFORM].end_tag_handler)
585 handlers[tagFORM].end_tag_handler(pdoc, child);
587 /*----------------------------------------------------------------------*/
589 /*----------------------------------------------------------------------*/
591 if (strcasecmp(name, "fieldset") == 0) {
592 if (handlers[tagFIELDSET].start_tag_handler)
593 handlers[tagFIELDSET].start_tag_handler(pdoc, child);
595 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
597 if (handlers[tagFIELDSET].end_tag_handler)
598 handlers[tagFIELDSET].end_tag_handler(pdoc, child);
601 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
607 /*----------------------------------------------------------------------*/
609 /*----------------------------------------------------------------------*/
610 if (strcasecmp(name, "input") == 0) {
611 if (handlers[tagINPUT].start_tag_handler)
612 handlers[tagINPUT].start_tag_handler(pdoc, child);
614 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
616 if (handlers[tagINPUT].end_tag_handler)
617 handlers[tagINPUT].end_tag_handler(pdoc, child);
619 /*----------------------------------------------------------------------*/
621 /*----------------------------------------------------------------------*/
623 if (strcasecmp(name, "img") == 0) {
624 if (handlers[tagIMG].start_tag_handler)
625 handlers[tagIMG].start_tag_handler(pdoc, child);
627 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
629 if (handlers[tagIMG].end_tag_handler)
630 handlers[tagIMG].end_tag_handler(pdoc, child);
633 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
639 /*----------------------------------------------------------------------*/
641 /*----------------------------------------------------------------------*/
642 if (strcasecmp(name, "select") == 0) {
643 if (handlers[tagSELECT].start_tag_handler)
644 handlers[tagSELECT].start_tag_handler(pdoc, child);
646 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
648 if (handlers[tagSELECT].end_tag_handler)
649 handlers[tagSELECT].end_tag_handler(pdoc, child);
651 /*----------------------------------------------------------------------*/
653 /*----------------------------------------------------------------------*/
655 if (strcasecmp(name, "style") == 0) {
656 if (handlers[tagSTYLE].start_tag_handler)
657 handlers[tagSTYLE].start_tag_handler(pdoc, child);
659 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
662 if (handlers[tagSTYLE].end_tag_handler)
663 handlers[tagSTYLE].end_tag_handler(pdoc, child);
665 /*----------------------------------------------------------------------*/
667 /*----------------------------------------------------------------------*/
669 if (strcasecmp(name, "span") == 0) {
670 if (handlers[tagSPAN].start_tag_handler)
671 handlers[tagSPAN].start_tag_handler(pdoc, child);
673 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
675 if (handlers[tagSPAN].end_tag_handler)
676 handlers[tagSPAN].end_tag_handler(pdoc, child);
678 /*----------------------------------------------------------------------*/
680 /*----------------------------------------------------------------------*/
682 if (strcasecmp(name, "small") == 0) {
683 if (handlers[tagSMALL].start_tag_handler)
684 handlers[tagSMALL].start_tag_handler(pdoc, child);
686 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
688 if (handlers[tagSMALL].end_tag_handler)
689 handlers[tagSMALL].end_tag_handler(pdoc, child);
691 /*----------------------------------------------------------------------*/
693 /*----------------------------------------------------------------------*/
695 if (strcasecmp(name, "script") == 0) {
696 /* ignore script block */
699 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
705 /*----------------------------------------------------------------------*/
707 /*----------------------------------------------------------------------*/
708 if (strcasecmp(name, "div") == 0) {
709 if (handlers[tagDIV].start_tag_handler)
710 handlers[tagDIV].start_tag_handler(pdoc, child);
712 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
714 if (handlers[tagDIV].end_tag_handler)
715 handlers[tagDIV].end_tag_handler(pdoc, child);
717 /*----------------------------------------------------------------------*/
719 /*----------------------------------------------------------------------*/
720 else if (strcasecmp(name, "dir") == 0) {
721 if (handlers[tagDIR].start_tag_handler)
722 handlers[tagDIR].start_tag_handler(pdoc, child);
724 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
726 if (handlers[tagDIR].end_tag_handler)
727 handlers[tagDIR].end_tag_handler(pdoc, child);
729 /*----------------------------------------------------------------------*/
731 /*----------------------------------------------------------------------*/
732 else if (strcasecmp(name, "dl") == 0) {
733 if (handlers[tagDL].start_tag_handler)
734 handlers[tagDL].start_tag_handler(pdoc, child);
736 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
738 if (handlers[tagDL].end_tag_handler)
739 handlers[tagDL].end_tag_handler(pdoc, child);
741 /*----------------------------------------------------------------------*/
743 /*----------------------------------------------------------------------*/
744 else if (strcasecmp(name, "dt") == 0) {
745 if (handlers[tagDT].start_tag_handler)
746 handlers[tagDT].start_tag_handler(pdoc, child);
748 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
750 if (handlers[tagDT].end_tag_handler)
751 handlers[tagDT].end_tag_handler(pdoc, child);
753 /*----------------------------------------------------------------------*/
755 /*----------------------------------------------------------------------*/
756 else if (strcasecmp(name, "dd") == 0) {
757 if (handlers[tagDD].start_tag_handler)
758 handlers[tagDD].start_tag_handler(pdoc, child);
760 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
762 if (handlers[tagDD].end_tag_handler)
763 handlers[tagDD].end_tag_handler(pdoc, child);
766 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
772 /*----------------------------------------------------------------------*/
774 /*----------------------------------------------------------------------*/
775 if (strcasecmp(name, QS_PARSE_NL_MARK) == 0) {
776 if (handlers[tagNLMARK].start_tag_handler)
777 handlers[tagNLMARK].start_tag_handler(pdoc, child);
780 /*----------------------------------------------------------------------*/
782 /*----------------------------------------------------------------------*/
783 if (strcasecmp(name, "center") == 0) {
784 if (handlers[tagCENTER].start_tag_handler)
785 handlers[tagCENTER].start_tag_handler(pdoc, child);
787 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
789 if (handlers[tagCENTER].end_tag_handler)
790 handlers[tagCENTER].end_tag_handler(pdoc, child);
792 /*----------------------------------------------------------------------*/
794 /*----------------------------------------------------------------------*/
796 if (strcasecmp(name, "chxj:if") == 0) {
797 if (chxj_chxjif_is_mine(spec, doc, child)) {
800 parse_attr = qs_get_parse_attr(doc, child, r->pool);
802 if (parse_attr && strcasecmp(parse_attr, "true") == 0) {
803 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
806 if (handlers[tagCHXJIF].start_tag_handler)
807 handlers[tagCHXJIF].start_tag_handler(pdoc, child);
812 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
818 /*----------------------------------------------------------------------*/
820 /*----------------------------------------------------------------------*/
821 if (strcasecmp(name, "textarea") == 0) {
822 if (handlers[tagTEXTAREA].start_tag_handler)
823 handlers[tagTEXTAREA].start_tag_handler(pdoc, child);
825 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
827 if (handlers[tagTEXTAREA].end_tag_handler)
828 handlers[tagTEXTAREA].end_tag_handler(pdoc, child);
831 /*----------------------------------------------------------------------*/
833 /*----------------------------------------------------------------------*/
834 if (strcasecmp(name, "title") == 0) {
835 if (handlers[tagTITLE].start_tag_handler)
836 handlers[tagTITLE].start_tag_handler(pdoc, child);
838 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
840 if (handlers[tagTITLE].end_tag_handler)
841 handlers[tagTITLE].end_tag_handler(pdoc, child);
843 /*----------------------------------------------------------------------*/
845 /*----------------------------------------------------------------------*/
847 if (strcasecmp(name, "table") == 0) {
848 if (handlers[tagTABLE].start_tag_handler)
849 handlers[tagTABLE].start_tag_handler(pdoc, child);
851 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
853 if (handlers[tagTABLE].end_tag_handler)
854 handlers[tagTABLE].end_tag_handler(pdoc, child);
856 /*----------------------------------------------------------------------*/
858 /*----------------------------------------------------------------------*/
860 if (strcasecmp(name, "tbody") == 0) {
861 if (handlers[tagTBODY].start_tag_handler)
862 handlers[tagTBODY].start_tag_handler(pdoc, child);
864 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
866 if (handlers[tagTBODY].end_tag_handler)
867 handlers[tagTBODY].end_tag_handler(pdoc, child);
869 /*----------------------------------------------------------------------*/
871 /*----------------------------------------------------------------------*/
873 if (strcasecmp(name, "th") == 0) {
874 if (handlers[tagTH].start_tag_handler)
875 handlers[tagTH].start_tag_handler(pdoc, child);
877 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
879 if (handlers[tagTH].end_tag_handler)
880 handlers[tagTH].end_tag_handler(pdoc, child);
882 /*----------------------------------------------------------------------*/
884 /*----------------------------------------------------------------------*/
886 if (strcasecmp(name, "tr") == 0) {
887 if (handlers[tagTR].start_tag_handler)
888 handlers[tagTR].start_tag_handler(pdoc, child);
890 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
892 if (handlers[tagTR].end_tag_handler)
893 handlers[tagTR].end_tag_handler(pdoc, child);
895 /*----------------------------------------------------------------------*/
897 /*----------------------------------------------------------------------*/
899 if (strcasecmp(name, "td") == 0) {
900 if (handlers[tagTD].start_tag_handler)
901 handlers[tagTD].start_tag_handler(pdoc, child);
903 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
905 if (handlers[tagTD].end_tag_handler)
906 handlers[tagTD].end_tag_handler(pdoc, child);
908 /*----------------------------------------------------------------------*/
910 /*----------------------------------------------------------------------*/
912 if (strcasecmp(name, "text") == 0) {
913 if (handlers[tagTEXT].start_tag_handler)
914 handlers[tagTEXT].start_tag_handler(pdoc, child);
917 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
922 chxj_node_convert(spec, r, pdoc, doc, child, indent+1);
931 chxj_node_convert_chxjif_only(
941 apr_size_t dst_pos = 0;
944 memset(&doc, 0, sizeof(Doc));
946 apr_pool_create(&doc.pool, r->pool);
949 dst = apr_palloc(doc.pool, *len + 1);
950 memset(dst, 0, *len + 1);
952 for (ii =0; ii<*len; ii++) {
953 if (src[ii + 0] == '<') {
954 apr_size_t endpoint = chxj_cut_tag(&src[ii + 0], *len - ii);
955 Node *node = qs_parse_tag(&doc, &src[ii], endpoint);
956 char *name = qs_get_node_name(&doc,node);
957 if (STRCASEEQ('c','C',"chxj:if", name)) {
958 if (! chxj_chxjif_is_mine(spec, &doc, node)) {
963 else if (STRCASEEQ('/','/', "/chxj:if", name)) {
970 memcpy(&dst[dst_pos], &src[ii], endpoint + 1);
971 dst_pos += (endpoint + 1);
973 dst[dst_pos++] = src[ii];
983 if (is_sjis_kanji(src[ii])) {
984 dst[dst_pos++] = src[ii++];
985 dst[dst_pos++] = src[ii];
988 dst[dst_pos++] = src[ii];