OSDN Git Service

Initial revision
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sun, 13 Mar 2005 17:02:38 +0000 (17:02 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Sun, 13 Mar 2005 17:02:38 +0000 (17:02 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/trunk@3 1a406e8e-add9-4483-a2c8-d8cac5b7c224

60 files changed:
AUTHORS [new file with mode: 0644]
CHECKLIST [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
TODO [new file with mode: 0644]
buildconf.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
etc/device_data.xml [new file with mode: 0644]
etc/emoji.xml [new file with mode: 0644]
java/build.properties [new file with mode: 0644]
java/build.xml [new file with mode: 0644]
java/src/com/qsdn/filter/CHXJFilter.java [new file with mode: 0644]
java/src/com/qsdn/filter/CHXJRequestWrapper.java [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/chxj_chtml10.c [new file with mode: 0644]
src/chxj_chtml10.h [new file with mode: 0644]
src/chxj_chtml20.c [new file with mode: 0644]
src/chxj_chtml20.h [new file with mode: 0644]
src/chxj_chtml30.c [new file with mode: 0644]
src/chxj_chtml30.h [new file with mode: 0644]
src/chxj_dump.c [new file with mode: 0644]
src/chxj_dump.h [new file with mode: 0644]
src/chxj_hdml.c [new file with mode: 0644]
src/chxj_hdml.h [new file with mode: 0644]
src/chxj_img_conv.c [new file with mode: 0644]
src/chxj_img_conv.h [new file with mode: 0644]
src/chxj_jhtml.c [new file with mode: 0644]
src/chxj_jhtml.h [new file with mode: 0644]
src/chxj_load_device_data.c [new file with mode: 0644]
src/chxj_load_device_data.h [new file with mode: 0644]
src/chxj_load_emoji_data.c [new file with mode: 0644]
src/chxj_load_emoji_data.h [new file with mode: 0644]
src/chxj_specified_device.c [new file with mode: 0644]
src/chxj_specified_device.h [new file with mode: 0644]
src/chxj_str_util.c [new file with mode: 0644]
src/chxj_str_util.h [new file with mode: 0644]
src/chxj_tag_util.c [new file with mode: 0644]
src/chxj_tag_util.h [new file with mode: 0644]
src/chxj_xhtml_mobile_1_0.c [new file with mode: 0644]
src/chxj_xhtml_mobile_1_0.h [new file with mode: 0644]
src/mod_chxj.c [new file with mode: 0644]
src/mod_chxj.h [new file with mode: 0644]
src/qs_ignore_sp.c [new file with mode: 0644]
src/qs_ignore_sp.h [new file with mode: 0644]
src/qs_log.c [new file with mode: 0644]
src/qs_log.h [new file with mode: 0644]
src/qs_malloc.c [new file with mode: 0644]
src/qs_malloc.h [new file with mode: 0644]
src/qs_parse_attr.c [new file with mode: 0644]
src/qs_parse_attr.h [new file with mode: 0644]
src/qs_parse_file.c [new file with mode: 0644]
src/qs_parse_file.h [new file with mode: 0644]
src/qs_parse_string.c [new file with mode: 0644]
src/qs_parse_string.h [new file with mode: 0644]
src/qs_parse_tag.c [new file with mode: 0644]
src/qs_parse_tag.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..21dc0cc
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Atsushi Konno <konno@qsdn.co.jp>
diff --git a/CHECKLIST b/CHECKLIST
new file mode 100644 (file)
index 0000000..bde9510
--- /dev/null
+++ b/CHECKLIST
@@ -0,0 +1,20 @@
+AU C413S          OK 2005/3/7 HDML
+AU A1012K II      OK 2005/3/7 HDML
+AU A3011SA        OK 2005/3/7
+AU A5402S         OK 2005/3/7 
+AU W21CA          OK 2005/3/7 XHTML
+DoCoMo N505iS     OK 2005/3/9 CHTML
+Vodafone V601N    OK 2005/3/9 JHTML
+AU W11H           OK 2005/3/9 XHTML
+Vodafone J-SA04   OK 2005/3/9 JHTML
+AU A5508SA(Talby) OK 2005/3/11 XHTML
+AU A5507SA        OK 2005/3/11 XHTML
+Vodafone 702sMO   OK 2005/3/11 JHTML istyle, format , mode \82·\82×\82Ä\96³\8e\8b\82³\82ê\82é\81B
+AU W21H           OK 2005/3/11 XHTML
+AU PENCK(W31H)    OK 2005/3/11 XHTML
+AU W31SA          OK 2005/3/11 XHTML
+AU A5509T         OK 2005/3/11 XHTML
+AU W21SA          OK 2005/3/11 XHTML
+AU W21K           OK 2005/3/11 XHTML
+AU A5505SA        OK 2005/3/11 XHTML
+AU A1404S         OK 2005/3/11 XHTML
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..48c4dc2
--- /dev/null
+++ b/README
@@ -0,0 +1,3 @@
+日本国内の主要携帯(3キャリア)向けコンテンツ変換ミドルウェアをApache2.0用のモジュールとして
+作成します。
+CHTMLで作成したコンテンツを出力時にUserAgentを見てHDML、XHTML、JHTMLに変換します。
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..fc4b90c
--- /dev/null
+++ b/TODO
@@ -0,0 +1,2 @@
+* Things TODO *
+
diff --git a/buildconf.sh b/buildconf.sh
new file mode 100755 (executable)
index 0000000..c810fd3
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# autogen.sh - generates configure using the autotools
+# $Id$
+#export WANT_AUTOCONF=2.5
+#libtoolize --force --copy
+rm -f ./aclocal.m4
+rm -f ./Makefile
+rm -f ./Makefile.in
+rm -f ./configure
+rm -f ./config.guess
+rm -f ./config.log
+rm -f ./config.sub
+rm -f ./config.status
+rm -f ./install-sh
+rm -f ./libtool
+rm -f ./ltmain.sh
+rm -f ./missing
+rm -f ./mkinstalldirs
+aclocal 
+autoheader
+automake -a -c 
+autoconf
+rm -rf autom4te.cache
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..750f083
--- /dev/null
@@ -0,0 +1,95 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+AC_INIT(mod_chxj, 0.1.0)
+AC_PREREQ(2.59)
+AC_CONFIG_SRCDIR([src/mod_chxj.c])
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_CONFIG_HEADER(src/config.h)
+
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+
+# Checks for libraries.
+AC_CHECK_LIB([apr-0],  [main])
+
+AC_ARG_WITH(apache-header, [  --with-apache-header=ARG The directory with the header file of apache2.0 is specified. ]) 
+#[, ACTION-IF-GIVEN[, ACTION-IF-NOT-GIVEN]])
+if test "x$with_apache_header" = "x"; then
+    AC_MSG_ERROR([
+Please specify the --with-apache-header option.
+])
+fi
+if test "x$with_apache_header" = "xyes"; then
+    AC_MSG_ERROR([
+Please specify the --with-apache-header option. And, please specify the place of the header file. 
+
+])
+fi
+AC_ARG_WITH(apr-header, [  --with-apr-header=ARG    The directory with the header file of apr library is specified. ]) 
+if test "x$with_apr_header" = "x"; then
+    AC_MSG_ERROR([
+Please specify the --with-apr-header option.
+])
+fi
+if test "x$with_apr_header" = "xyes"; then
+    AC_MSG_ERROR([
+Please specify the --with-apr-header option. And, please specify the place of the header file. 
+
+])
+fi
+
+AC_ARG_WITH(apr-header,   [  --with-apr-header=ARG    The directory with the header file of apr library is specified. ]) 
+AC_ARG_ENABLE(img-conv-f, [  --enable-img-conv-f      Please specify it when you change the file name of the image being written in the 
+source by the automatic operation.])
+if test "x$enable_img_conv_f" = "xyes"; then
+  QDEFS=""
+else
+  QDEFS="-DIMG_NOT_CONVERT_FILENAME"
+fi
+
+AC_ARG_ENABLE(dump-log, [  --enable-dump-log   When the log of conversion is output, it specifies it with the output file. ])
+if test "x$enable_dump_log" = "xyes"; then
+  DDEFS="-DDUMP_LOG=\\\"/tmp/dump.log\\\""
+else
+    if test "x$enable_dump_log" != "x" ; then
+        DDEFS="-DDUMP_LOG=\\\"${enable_dump_log}\\\""
+    fi
+fi
+
+
+AC_SUBST(with_apache_header)
+AC_SUBST(with_apr_header)
+AC_SUBST(CC)
+AC_SUBST(QDEFS)
+AC_SUBST(DDEFS)
+AC_SUBST(LIBS)
+
+AC_PATH_PROG(APXS, apxs, no,
+    /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
+if test "x$APXS" = "xno"; then
+    AC_MSG_ERROR([apxs not found.])
+fi
+
+AC_PATH_PROG(LIBTOOL, libtool, no,
+    /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
+if test "x$LIBTOOL" = "xno"; then
+    AC_MSG_ERROR([libtool not found.])
+fi
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([string.h strings.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([memset memcpy strcasecmp strncasecmp strstr])
+
+AC_CONFIG_FILES([Makefile src/Makefile])
+AC_OUTPUT
diff --git a/etc/device_data.xml b/etc/device_data.xml
new file mode 100644 (file)
index 0000000..1dc775b
--- /dev/null
@@ -0,0 +1,6066 @@
+<?xml encoding="Shift_JIS" ?>
+<devices>
+  <!--=======================================================================-->
+  <!-- AU                                                                    -->
+  <!--=======================================================================-->
+  <user_agent pattern="KDDI-([^     ]+) UP.Browser/[^   ]+ .+">
+    <!--======================================================================-->
+    <!-- C3000 series                                                         -->
+    <!--======================================================================-->
+    <!-- C3001H -->
+    <device>
+      <device_id>HI21</device_id>
+      <device_name>C3001H</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <!-- C3002K -->
+    <device>
+      <device_id>KC21</device_id>
+      <device_name>C3002K</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>128</width>
+      <heigh>132</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+  
+    <!-- C3003P -->
+    <device>
+      <device_id>MA21</device_id>
+      <device_name>C3003P</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- W series                                                             -->
+    <!--======================================================================-->
+    <!-- W11H -->
+    <device>
+      <device_id>HI31</device_id>
+      <device_name>W11H</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>233</width>
+      <heigh>268</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>KC31</device_id>
+      <device_name>W11K</device_id>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>233</width>
+      <heigh>268</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>HI32</device_id>
+      <device_name>W21H</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>123</width>
+      <heigh>147</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>15680000</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SA31</device_id>
+      <device_name>W21SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>225</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN31</device_id>
+      <device_name>W21S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>228</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>KC32</device_id>
+      <device_name>W21K</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>234</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>TS31</device_id>
+      <device_name>W21T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>229</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>CA31</device_id>
+      <device_name>W21CA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>123</width>
+      <heigh>147</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>HI33</device_id>
+      <device_name>W22H</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>230</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SA32</device_id>
+      <device_name>W22SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>230</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <!--=====================================================================-->
+    <!-- A5000 series                                                        -->
+    <!--=====================================================================-->
+
+    <device>
+      <device_id>TS23</device_id>
+      <device_name>A5301T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>144</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>CA22</device_id>
+      <device_name>A5302CA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>147</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>15680000</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>HI23</device_id>
+      <device_name>A5303H</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>HI24</device_id>
+      <device_name>A5303H II</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>TS24</device_id>
+      <device_name>A5304T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>144</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>KC22</device_id>
+      <device_name>A5305K</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>ST21</device_id>
+      <device_name>A5306ST</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>145</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>ST22</device_id>
+      <device_name>INFOBAR</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>145</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>CA23</device_id>
+      <device_name>A5401CA/A5401CA II</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>123</width>
+      <heigh>147</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>15680000</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN24</device_id>
+      <device_name>A5402S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>120</width>
+      <heigh>160</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>CA24</device_id>
+      <device_name>A5403CA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>230</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>15680000</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN25</device_id>
+      <device_name>A5404S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>240</width>
+      <heigh>256</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>ST23</device_id>
+      <device_name>A5405SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>127</width>
+      <heigh>145</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>CA25</device_id>
+      <device_name>A5406CA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>230</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>15680000</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>CA26</device_id>
+      <device_name>A5407CA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>230</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>15680000</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>TS26</device_id>
+      <device_name>A5501T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>KC24</device_id>
+      <device_name>A5502K(A5502K_A)</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>234</width>
+      <heigh>262</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>KC25</device_id>
+      <device_name>A5502K(A5502K_B)</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>234</width>
+      <heigh>262</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SA26</device_id>
+      <device_name>A5503SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>225</width>
+      <heigh>263</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>TS27</device_id>
+      <device_name>A5504T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>229</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>TS28</device_id>
+      <device_name>A5506T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>229</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>ST24</device_id>
+      <device_name>A5507SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>235</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>ST25</device_id>
+      <device_name>talby(A5508SA)</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>235</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- C5000 series                                                         -->
+    <!--======================================================================-->
+    <device>
+      <device_id>TS21</device_id>
+      <device_name>C5001T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>144</width>
+      <heigh>135</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- A3000 series                                                         -->
+    <!--======================================================================-->
+
+    <device>
+      <device_id>SA21</device_id>
+      <device_name>A3011SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>126</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>CA21</device_id>
+      <device_name>A3012CA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>125</width>
+      <heigh>147</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TS22</device_id>
+      <device_name>A3013T</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>144</width>
+      <heigh>135</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN21</device_id>
+      <device_name>A3014S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SA22</device_id>
+      <device_name>A3015SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>126</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- A1400 series                                                         -->
+    <!--======================================================================-->
+
+    <device>
+      <device_id>KC23</device_id>
+      <device_name>A1401K</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>126</width>
+      <heigh>136</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN26</device_id>
+      <device_name>A1402S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>228</width>
+      <heigh>244</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN27</device_id>
+      <device_name>A1402S II(A1402S2_A)</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>228</width>
+      <heigh>244</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN28</device_id>
+      <device_name>A1402S II (A1402S2_B)</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>228</width>
+      <heigh>244</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SN29</device_id>
+      <device_name>A1404S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>228</width>
+      <heigh>230</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>KC26</device_id>
+      <device_name>A1403K</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>234</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- A1300 series                                                         -->
+    <!--======================================================================-->
+    <device>
+      <device_id>SN23</device_id>
+      <device_name>A1301S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>120</width>
+      <heigh>123</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SA24</device_id>
+      <device_name>A1302SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SA25</device_id>
+      <device_name>A1303SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>TS25</device_id>
+      <device_name>A1304T A1304T II (A1304T)</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>144</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>SA28</device_id>
+      <device_name>A1305SA</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>124</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- A1100 series                                                         -->
+    <!--======================================================================-->
+    <device>
+      <device_id>SN22</device_id>
+      <device_name>A1101S</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+
+    <!--======================================================================-->
+    <!-- UNKNOWN                                                              -->
+    <!--======================================================================-->
+    <device>
+      <device_id>UNKNOWN</device_id>
+      <device_name>UNKNOWN_XHTML_DEVICE</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>233</width>
+      <heigh>268</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="UP.Browser/[^\-]+-([^     ]+) .+">
+    <!--======================================================================-->
+    <!-- A1000 series                                                         -->
+    <!--======================================================================-->
+    <device>
+      <device_id>ST13</device_id>
+      <device_name>A1011ST</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type><!-- XXX -->
+    </device>
+    <device>
+      <device_id>KC14</device_id>
+      <device_name>A1012K</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type><!-- XXX -->
+    </device>
+    <device>
+      <device_id>KC15</device_id>
+      <device_name>A1013K</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>ST14</device_id>
+      <device_name>A1014ST</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>108</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- C1000 series                                                         -->
+    <!--======================================================================-->
+    <device>
+      <device_id>SY15</device_id>
+      <device_name>C1001SA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>128</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN17</device_id>
+      <device_name>C1002S</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- C400 series                                                          -->
+    <!--======================================================================-->
+    <device>
+      <device_id>SY12</device_id>
+      <device_name>C401SA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>128</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+
+    <device>
+      <device_id>DN11</device_id>
+      <device_name>C402DE</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>ST11</device_id>
+      <device_name>C403ST</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN12</device_id>
+      <device_name>C404S(C404S_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN14</device_id>
+      <device_name>C404S(C404S_B)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SY13</device_id>
+      <device_name>C405SA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN13</device_id>
+      <device_name>C406S</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>HI13</device_id>
+      <device_name>C407H</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>113</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>MA13</device_id>
+      <device_name>C408P</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>115</width>
+      <heigh>129</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>CA13</device_id>
+      <device_name>C409CA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TS13</device_id>
+      <device_name>C410T</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>98</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>ST12</device_id>
+      <device_name>C411ST</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SY14</device_id>
+      <device_name>C412SA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>128</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN16</device_id>
+      <device_name>C413S(C413S_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SN15</device_id>
+      <device_name>C413S(C413S_B)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KC13</device_id>
+      <device_name>C414K</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>128</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TS14</device_id>
+      <device_name>C415T</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>98</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>HI14</device_id>
+      <device_name>C451H</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>113</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>CA14</device_id>
+      <device_name>C452CA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>109</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- C300 series                                                          -->
+    <!--======================================================================-->
+    <device>
+      <device_id>TS11</device_id>
+      <device_name>C301T</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>84</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>HI11</device_id>
+      <device_name>C302H</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>75</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>CA11</device_id>
+      <device_name>C303CA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>91</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>SY11</device_id>
+      <device_name>C304SA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>128</width>
+      <heigh>096</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>SN11</device_id>
+      <device_name>C305S</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>098</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>MA11</device_id>
+      <device_name>C308P(C308P_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>122</width>
+      <heigh>078</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>MA12</device_id>
+      <device_name>C308P(C308P_B)</device_name>
+      <html_spec_type>HTML</html_spec_type>
+      <width>122</width>
+      <heigh>078</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>HI12</device_id>
+      <device_name>C309H</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>TS12</device_id>
+      <device_name>C310T</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96\81~</width>
+      <heigh>8</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>CA12</device_id>
+      <device_name>C311CA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>90</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>KC12</device_id>
+      <device_name>C313K</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>090</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- C200 series                                                          -->
+    <!--======================================================================-->
+    <device>
+      <device_id>HI01</device_id>
+      <device_name>C201H(C201H_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>51</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>HI02</device_id>
+      <device_name>C201H(C201H_A)</device_name>
+      <html_spec_type>HTML</html_spec_type>
+      <width>120</width>
+      <heigh>051</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>DN01</device_id>
+      <device_name>C202DE</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>108</width>
+      <heigh>039</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- Digital series                                                       -->
+    <!--======================================================================-->
+    <device>
+      <device_id>SYC1</device_id>
+      <device_name>D301SA</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>128</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>TSC1</device_id>
+      <device_name>D302T</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>84</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>TSI1</device_id>
+      <device_name>701G</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>94</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCC1</device_id>
+      <device_name>D303K</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>94</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCI1</device_id>
+      <device_name>702G</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>094</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCC2</device_id>
+      <device_name>D304K</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>094</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCI2</device_id>
+      <device_name>703G</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>094</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+
+    <device>
+      <device_id>MAC1</device_id>
+      <device_name>D305P(D305P_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>122</width>
+      <heigh>78</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+
+    <device>
+      <device_id>MAC2</device_id>
+      <device_name>D305P(D305P_B)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>122</width>
+      <heigh>78</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+
+    <device>
+      <device_id>MAI1</device_id>
+      <device_name>704G(704G_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>78</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+
+    <device>
+      <device_id>MAI2</device_id>
+      <device_name>D704G(704G_B)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>78</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>SNC1</device_id>
+      <device_name>D306S</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>SNI1</device_id>
+      <device_name>705G</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <!--======================================================================-->
+    <!-- TU-KA series                                                         -->
+    <!--======================================================================-->
+
+    <device>
+      <device_id>SYT1</device_id>
+      <device_name>TS01</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>128</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>TST1</device_id>
+      <device_name>TT01</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>84</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT1</device_id>
+      <device_name>TK01</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>94</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT2</device_id>
+      <device_name>TK02(TK02_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>94</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT3</device_id>
+      <device_name>TK02(TK02_B)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>121</width>
+      <heigh>94</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>TST2</device_id>
+      <device_name>TT02</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>84</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>MAT1</device_id>
+      <device_name>TP(TP01_A)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>122</width>
+      <heigh>78</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>MAT2</device_id>
+      <device_name>TP01(TP01_B)</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>122</width>
+      <heigh>78</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>true</bmp2>
+      <bmp4>true</bmp4>
+      <color>4</color>
+      <emoji_type>A</emoji_type>
+    </device>
+    <device>
+      <device_id>SYT2</device_id>
+      <device_name>TS02</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>72</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT4</device_id>
+      <device_name>TK03</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT5</device_id>
+      <device_name>TK04</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>TST3</device_id>
+      <device_name>TT03</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT6</device_id>
+      <device_name>TK05</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>MAT3</device_id>
+      <device_name>TP11</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>94</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>MIT1</device_id>
+      <device_name>TD11</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT7</device_id>
+      <device_name>TK11</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>B</emoji_type>
+    </device>
+    <device>
+      <device_id>SYT3</device_id>
+      <device_name>TS11</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>128</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT8</device_id>
+      <device_name>TK12</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TST4</device_id>
+      <device_name>TT11</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>129</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TST5</device_id>
+      <device_name>TT21</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>140</width>
+      <heigh>133</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCT9</device_id>
+      <device_name>TK21</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TST6</device_id>
+      <device_name>TT22</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>140</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCTA</device_id>
+      <device_name>TK22</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCTB</device_id>
+      <device_name>TK23</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SYT4</device_id>
+      <device_name>TS31</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>108</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCTC</device_id>
+      <device_name>TK31</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TST7</device_id>
+      <device_name>TT31</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>140</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>TST8</device_id>
+      <device_name>TT32</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>140</width>
+      <heigh>120</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCTD</device_id>
+      <device_name>TK40</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>120</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>true</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>SYT5</device_id>
+      <device_name>TS41</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>C</emoji_type>
+    </device>
+    <device>
+      <device_id>KCU1</device_id>
+      <device_name>TK41</device_name>
+      <html_spec_type>XHTML_MOBILE_1_0</html_spec_type>
+      <width>114</width>
+      <heigh>137</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type>D</emoji_type>
+    </device>
+    <device>
+      <device_id>UNKNOWN</device_id>
+      <device_name>UNKNOWN_HTML_DEVICE</device_name>
+      <html_spec_type>HDML</html_spec_type>
+      <width>114</width>
+      <heigh>137</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>0</color>
+      <emoji_type>A</emoji_type>
+    </device>
+  </user_agent>
+  <!--=======================================================================-->
+  <!-- DoCoMo                                                                -->
+  <!--=======================================================================-->
+  <user_agent pattern="DoCoMo/1.0/([^   /]+)$">
+
+    <device>
+      <device_id>D501i</device_id>
+      <device_name>D501i</device_name>
+      <html_spec_type>CHTML_1_0</html_spec_type>
+      <width>96</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F501i</device_id>
+      <device_name>F501i</device_name>
+      <html_spec_type>CHTML_1_0</html_spec_type>
+      <width>112</width>
+      <heigh>84</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N501i</device_id>
+      <device_name>N501i</device_name>
+      <html_spec_type>CHTML_1_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P501i</device_id>
+      <device_name>P501i</device_name>
+      <html_spec_type>CHTML_1_0</html_spec_type>
+      <width>96</width>
+      <heigh>120</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <device>
+      <device_id>F502i</device_id>
+      <device_name>F502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D502i</device_id>
+      <device_name>D502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>90</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N502i</device_id>
+      <device_name>N502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P502i</device_id>
+      <device_name>P502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>117</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>NM502i</device_id>
+      <device_name>NM502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>111</width>
+      <heigh>106</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO502i</device_id>
+      <device_name>SO502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>120</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F502it</device_id>
+      <device_name>F502it</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N502it</device_id>
+      <device_name>N502it</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH821i</device_id>
+      <device_name>SH821i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>78</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N821i</device_id>
+      <device_name>N821i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P821i</device_id>
+      <device_name>P821i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <device>
+      <device_id>F209i</device_id>
+      <device_name>F209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N209i</device_id>
+      <device_name>N209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>108</width>
+      <heigh>82</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P209i</device_id>
+      <device_name>P209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>87</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D209i</device_id>
+      <device_name>D209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>90</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P209iS</device_id>
+      <device_name>P209iS</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>87</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>ER209i</device_id>
+      <device_name>ER209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>R209i</device_id>
+      <device_name>R209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>KO209i</device_id>
+      <device_name>KO209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>96</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>R691i</device_id>
+      <device_name>R691i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N210i</device_id>
+      <device_name>N210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P210i</device_id>
+      <device_name>P210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>KO210i</device_id>
+      <device_name>KO210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>96</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="DoCoMo/1.0/([^   /]+)/c[0-9][0-9]$">
+    <device>
+      <device_id>ISIM60</device_id>
+      <device_name>ISIM60</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>96</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F502i</device_id>
+      <device_name>F502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D502i</device_id>
+      <device_name>D502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>90</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N502i</device_id>
+      <device_name>N502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P502i</device_id>
+      <device_name>P502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>117</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>NM502i</device_id>
+      <device_name>NM502i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>111</width>
+      <heigh>106</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F502it</device_id>
+      <device_name>F502it</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N502it</device_id>
+      <device_name>N502it</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO502iWM</device_id>
+      <device_name>SO502iWM</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <device>
+      <device_id>SH821i</device_id>
+      <device_name>SH821i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>78</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P821i</device_id>
+      <device_name>P821i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N821i</device_id>
+      <device_name>N821i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F209i</device_id>
+      <device_name>F209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N209i</device_id>
+      <device_name>N209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>108</width>
+      <heigh>82</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P209i</device_id>
+      <device_name>P209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>87</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D209i</device_id>
+      <device_name>D209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>90</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P209iS</device_id>
+      <device_name>P209iS</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>87</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>ER209i</device_id>
+      <device_name>ER209i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>2</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>R691i</device_id>
+      <device_name>R691i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>72</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N210i</device_id>
+      <device_name>N210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>118</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F210i</device_id>
+      <device_name>F210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P210i</device_id>
+      <device_name>P210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>KO210i</device_id>
+      <device_name>KO210i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>96</width>
+      <heigh>96</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D210i</device_id>
+      <device_name>D210i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>96</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO210i</device_id>
+      <device_name>SO210i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F671i</device_id>
+      <device_name>F671i</device_name>
+      <html_spec_type>CHTML_2_0</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F503i</device_id>
+      <device_name>F503i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <device>
+      <device_id>F503iS</device_id>
+      <device_name>F503iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P503i</device_id>
+      <device_name>P503i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P503iS</device_id>
+      <device_name>P503iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N503i</device_id>
+      <device_name>N503i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N503iS</device_id>
+      <device_name>N503iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO503i</device_id>
+      <device_name>SO503i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO503iS</device_id>
+      <device_name>SO503iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D503i</device_id>
+      <device_name>D503i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>132</width>
+      <heigh>126</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D503iS</device_id>
+      <device_name>D503iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>132</width>
+      <heigh>126</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <device>
+      <device_id>F211i</device_id>
+      <device_name>F211i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>96</width>
+      <heigh>113</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D211i</device_id>
+      <device_name>D211i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>100</width>
+      <heigh>91</heigh>
+      <gif>true</gif>
+      <jpeg>false</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N211i</device_id>
+      <device_name>N211i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P211i</device_id>
+      <device_name>P211i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>R211i</device_id>
+      <device_name>R211i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>96</width>
+      <heigh>98</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO211i</device_id>
+      <device_name>SO211i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N211iS</device_id>
+      <device_name>N211iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P211iS</device_id>
+      <device_name>P211iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>R692i</device_id>
+      <device_name>R692i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>96</width>
+      <heigh>98</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D504i</device_id>
+      <device_name>R692i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="DoCoMo/2.0[  ]+([^( ]+)\(.+\)$">
+    <device>
+      <device_id>N2001</device_id>
+      <device_name>N2001</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N2002</device_id>
+      <device_name>N2002</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P2002</device_id>
+      <device_name>P2002</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>118</width>
+      <heigh>128</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <device>
+      <device_id>P2101V</device_id>
+      <device_name>P2101V</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>163</width>
+      <heigh>182</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D2101V</device_id>
+      <device_name>D2101V</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>MST_v_SH2101V</device_id>
+      <device_name>SH2101V</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>800</width>
+      <heigh>600</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>T2101V</device_id>
+      <device_name>T2101V</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>176</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F2051</device_id>
+      <device_name>F2051</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>182</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N2051</device_id>
+      <device_name>N2051</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P2102V</device_id>
+      <device_name>P2102V</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F2102V</device_id>
+      <device_name>F2102V</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N2102V</device_id>
+      <device_name>N2102V</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N2701</device_id>
+      <device_name>N2701</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F880iES</device_id>
+      <device_name>F880iES</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>256</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F900i</device_id>
+      <device_name>F900i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>230</width>
+      <heigh>240</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N900i</device_id>
+      <device_name>N900i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>269</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P900i</device_id>
+      <device_name>P900i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH900i</device_id>
+      <device_name>SH900i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>252</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D900i</device_id>
+      <device_name>D900i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P900iV</device_id>
+      <device_name>P900iV</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N900iS</device_id>
+      <device_name>N900iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>269</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F900iT</device_id>
+      <device_name>F900iT</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>230</width>
+      <heigh>240</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F900iC</device_id>
+      <device_name>F900iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>230</width>
+      <heigh>240</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N900iL</device_id>
+      <device_name>N900iL</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>269</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N900iG</device_id>
+      <device_name>N900iG</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>269</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH901iC</device_id>
+      <device_name>SH901iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>252</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F901iC</device_id>
+      <device_name>F901iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>230</width>
+      <heigh>240</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N901iC</device_id>
+      <device_name>N901iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D901i</device_id>
+      <device_name>D901i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>230</width>
+      <heigh>240</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P901i</device_id>
+      <device_name>P901i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="DoCoMo/1.0/([^   /]+)/c[0-9][0-9]/TB$">
+    <device>
+      <device_id>F504i</device_id>
+      <device_name>F504i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F504iS</device_id>
+      <device_name>F504iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N504i</device_id>
+      <device_name>N504i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N504iS</device_id>
+      <device_name>N504iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO504i</device_id>
+      <device_name>SO504i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P504i</device_id>
+      <device_name>P504i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P504iS</device_id>
+      <device_name>P504iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH251i</device_id>
+      <device_name>SH251i</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH251iS</device_id>
+      <device_name>SH251iS</device_name>
+      <html_spec_type>CHTML_3_0</html_spec_type>
+      <width>176</width>
+      <heigh>187</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D251i</device_id>
+      <device_name>D251i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D251iS</device_id>
+      <device_name>D251iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F251i</device_id>
+      <device_name>F251i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N251i</device_id>
+      <device_name>N251i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N251iS</device_id>
+      <device_name>N251iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P251iS</device_id>
+      <device_name>P251iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F671iS</device_id>
+      <device_name>F671iS</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>160</width>
+      <heigh>120</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO212i</device_id>
+      <device_name>SO212i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F212i</device_id>
+      <device_name>F212i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F661i</device_id>
+      <device_name>F661i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F672i</device_id>
+      <device_name>F672i</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>160</width>
+      <heigh>120</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO213i</device_id>
+      <device_name>premini (SO213i)</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO213iS</device_id>
+      <device_name>premini-S (SO213iS)</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N2701</device_id>
+      <device_name>N2701</device_name>
+      <html_spec_type>CHTML_4_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="DoCoMo/1.0/([^   /]+)/c[0-9][0-9]/TB/W[0-9][0-9]H[0-9][0-9]$$">
+    <device>
+      <device_id>P213i</device_id>
+      <device_name>prosolid(P213i)</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D505i</device_id>
+      <device_name>D505i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D505iS</device_id>
+      <device_name>D505iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO505i</device_id>
+      <device_name>SO505i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>256</width>
+      <heigh>240</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO505iS</device_id>
+      <device_name>SO505iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>256</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH505i</device_id>
+      <device_name>SH505i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>252</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH505iS</device_id>
+      <device_name>SH505iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>252</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N505i</device_id>
+      <device_name>N505i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N505iS</device_id>
+      <device_name>N505iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F505i</device_id>
+      <device_name>F505i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>268</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F505iGPS</device_id>
+      <device_name>F505iGPS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>268</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P505i</device_id>
+      <device_name>P505i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P505iS</device_id>
+      <device_name>P505iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D252i</device_id>
+      <device_name>D252i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH252i</device_id>
+      <device_name>SH252i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>252</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P252i</device_id>
+      <device_name>P252i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N252i</device_id>
+      <device_name>N252i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>132</width>
+      <heigh>140</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P252iS</device_id>
+      <device_name>P252iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D253i</device_id>
+      <device_name>D253i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>176</width>
+      <heigh>198</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N253i</device_id>
+      <device_name>N253i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P253i</device_id>
+      <device_name>P253i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D253iWM</device_id>
+      <device_name>MusicPORTER(D253iWM)</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>220</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P253iS</device_id>
+      <device_name>Lechiffon(P253iS)</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>D506i</device_id>
+      <device_name>D506i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>270</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>F506i</device_id>
+      <device_name>F506i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>268</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N506i</device_id>
+      <device_name>N506i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>295</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>P506iC</device_id>
+      <device_name>P506iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>266</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SH506iC</device_id>
+      <device_name>SH506iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>252</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO506iC</device_id>
+      <device_name>SO506iC</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>256</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>N506iS</device_id>
+      <device_name>N506iS</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>295</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>SO506i</device_id>
+      <device_name>premini-II SO506i</device_name>
+      <html_spec_type>CHTML_5_0</html_spec_type>
+      <width>240</width>
+      <heigh>256</heigh>
+      <gif>true</gif>
+      <jpeg>true</jpeg>
+      <png>false</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+
+  <!--=======================================================================-->
+  <!-- Vodafone/J-Phone                                                      -->
+  <!--=======================================================================-->
+  <user_agent pattern="J-PHONE/[^/ ]+/([^/_]+)$">
+    <!-- C2 -->
+    <device>
+      <device_id>J-SH02</device_id>
+      <device_name>J-SH02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>89</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-DN02</device_id>
+      <device_name>J-DN02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>116</width>
+      <heigh>122</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-P02</device_id>
+      <device_name>J-P02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>89</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA02</device_id>
+      <device_name>J-SA02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>76</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH03</device_id>
+      <device_name>J-SH03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T04</device_id>
+      <device_name>J-T04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>90</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-P03</device_id>
+      <device_name>J-P03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>95</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <!-- C3 -->
+    <device>
+      <device_id>J-K03</device_id>
+      <device_name>J-K03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K03S</device_id>
+      <device_name>J-K03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D03</device_id>
+      <device_name>J-D03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D03S</device_id>
+      <device_name>J-D03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-PE03</device_id>
+      <device_name>J-PE03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-PE03S</device_id>
+      <device_name>J-PE03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04</device_id>
+      <device_name>J-SH04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04S</device_id>
+      <device_name>J-SH04S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04B</device_id>
+      <device_name>J-SH04B</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04BS</device_id>
+      <device_name>J-SH04BS</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH05</device_id>
+      <device_name>J-SH05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH05S</device_id>
+      <device_name>J-SH05S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N03</device_id>
+      <device_name>J-N03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N03S</device_id>
+      <device_name>J-N03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T05</device_id>
+      <device_name>J-T05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K04</device_id>
+      <device_name>J-K04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D04</device_id>
+      <device_name>J-D04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-PE03II</device_id>
+      <device_name>J-PE03II</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH06</device_id>
+      <device_name>J-SH06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA03</device_id>
+      <device_name>J-SA03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-DN03</device_id>
+      <device_name>J-DN03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-NM01</device_id>
+      <device_name>J-NM01</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N03II</device_id>
+      <device_name>J-N03II</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D31</device_id>
+      <device_name>J-D31</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA04</device_id>
+      <device_name>J-SA04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K05</device_id>
+      <device_name>J-K05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-NM02</device_id>
+      <device_name>J-NM02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA05</device_id>
+      <device_name>J-SA05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T07</device_id>
+      <device_name>J-T07</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>136</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T09</device_id>
+      <device_name>J-T09</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA06</device_id>
+      <device_name>J-SA06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V301T</device_id>
+      <device_name>V301T</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>261</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V301D</device_id>
+      <device_name>V301D</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V301T</device_id>
+      <device_name>V301T</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>KOTO</device_id>
+      <device_name>KOTO</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>320</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V303T</device_id>
+      <device_name>V303T</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>320</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <!-- C4 -->
+    <device>
+      <device_id>J-SH07</device_id>
+      <device_name>J-SH07</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T06</device_id>
+      <device_name>J-T06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D05</device_id>
+      <device_name>J-D05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D06</device_id>
+      <device_name>J-D06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N04</device_id>
+      <device_name>J-N04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N05</device_id>
+      <device_name>J-N05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH08</device_id>
+      <device_name>J-SH08</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH09</device_id>
+      <device_name>J-SH09</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T08</device_id>
+      <device_name>J-T08</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>261</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <!-- J-SH010\82ÌUser-Agent\82Í\81AJ-SH10\82Æ\82È\82Á\82Ä\82¢\82é -->
+      <device_id>J-SH10</device_id>
+      <device_name>J-SH010</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>240</width>
+      <heigh>260</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D08</device_id>
+      <device_name>J-D08</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <!-- J-T010\82ÌUser-Agent\82Í\81AJ-T10\82Æ\82È\82Á\82Ä\82¢\82é -->
+      <device_id>J-T10</device_id>
+      <device_name>J-T010</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>261</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V401SH</device_id>
+      <device_name>V401SH</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>260</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="J-PHONE/[^/ ]+/([^/_]+)_.+$">
+    <!-- C2 -->
+    <device>
+      <device_id>J-SH02</device_id>
+      <device_name>J-SH02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>89</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-DN02</device_id>
+      <device_name>J-DN02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>116</width>
+      <heigh>122</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-P02</device_id>
+      <device_name>J-P02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>89</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA02</device_id>
+      <device_name>J-SA02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>76</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH03</device_id>
+      <device_name>J-SH03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T04</device_id>
+      <device_name>J-T04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>90</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-P03</device_id>
+      <device_name>J-P03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>95</heigh>
+      <gif>false</gif>
+      <jpeg>false</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA04</device_id>
+      <device_name>J-SA04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <emoji_type></emoji_type>
+    </device>
+    <!-- C3 -->
+    <device>
+      <device_id>J-K03</device_id>
+      <device_name>J-K03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K03S</device_id>
+      <device_name>J-K03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D03</device_id>
+      <device_name>J-D03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D03S</device_id>
+      <device_name>J-D03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-PE03</device_id>
+      <device_name>J-PE03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-PE03S</device_id>
+      <device_name>J-PE03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04</device_id>
+      <device_name>J-SH04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04S</device_id>
+      <device_name>J-SH04S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04B</device_id>
+      <device_name>J-SH04B</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH04BS</device_id>
+      <device_name>J-SH04BS</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH05</device_id>
+      <device_name>J-SH05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH05S</device_id>
+      <device_name>J-SH05S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N03</device_id>
+      <device_name>J-N03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N03S</device_id>
+      <device_name>J-N03S</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T05</device_id>
+      <device_name>J-T05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K04</device_id>
+      <device_name>J-K04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D04</device_id>
+      <device_name>J-D04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-PE03II</device_id>
+      <device_name>J-PE03II</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>96</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH06</device_id>
+      <device_name>J-SH06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>96</width>
+      <heigh>104</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA03</device_id>
+      <device_name>J-SA03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-DN03</device_id>
+      <device_name>J-DN03</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-NM01</device_id>
+      <device_name>J-NM01</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N03II</device_id>
+      <device_name>J-N03II</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D31</device_id>
+      <device_name>J-D31</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA04</device_id>
+      <device_name>J-SA04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K05</device_id>
+      <device_name>J-K05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>110</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>256</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-NM02</device_id>
+      <device_name>J-NM02</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA05</device_id>
+      <device_name>J-SA05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>112</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T07</device_id>
+      <device_name>J-T07</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>136</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T09</device_id>
+      <device_name>J-T09</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA06</device_id>
+      <device_name>J-SA06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V301T</device_id>
+      <device_name>V301T</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>261</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V301D</device_id>
+      <device_name>V301D</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V301T</device_id>
+      <device_name>V301T</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>KOTO</device_id>
+      <device_name>KOTO</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>320</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V303T</device_id>
+      <device_name>V303T</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>320</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+
+    <!-- C4 -->
+    <device>
+      <device_id>J-SH07</device_id>
+      <device_name>J-SH07</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T06</device_id>
+      <device_name>J-T06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D05</device_id>
+      <device_name>J-D05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D06</device_id>
+      <device_name>J-D06</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N04</device_id>
+      <device_name>J-N04</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>126</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N05</device_id>
+      <device_name>J-N05</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH08</device_id>
+      <device_name>J-SH08</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>117</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SH09</device_id>
+      <device_name>J-SH09</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T08</device_id>
+      <device_name>J-T08</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>261</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <!-- J-SH010\82ÌUser-Agent\82Í\81AJ-SH10\82Æ\82È\82Á\82Ä\82¢\82é -->
+      <device_id>J-SH10</device_id>
+      <device_name>J-SH010</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>240</width>
+      <heigh>260</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-D08</device_id>
+      <device_name>J-D08</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>136</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <!-- J-T010\82ÌUser-Agent\82Í\81AJ-T10\82Æ\82È\82Á\82Ä\82¢\82é -->
+      <device_id>J-T10</device_id>
+      <device_name>J-T010</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>261</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V401SH</device_id>
+      <device_name>V401SH</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>222</width>
+      <heigh>260</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+
+
+  <user_agent pattern="J-PHONE/[^/ ]+/([^/ _]+?)[/ _].+?$">
+    <!-- P4 -->
+    <device>
+      <device_id>J-SH51</device_id>
+      <device_name>J-SH51</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-K51</device_id>
+      <device_name>J-K51</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>128</width>
+      <heigh>128</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>4096</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-T51</device_id>
+      <device_name>J-T51</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>144</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-P51</device_id>
+      <device_name>J-P51</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA51</device_id>
+      <device_name>J-SA51</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>132</width>
+      <heigh>144</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-SA52</device_id>
+      <device_name>J-SA52</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>120</width>
+      <heigh>130</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>J-N51</device_id>
+      <device_name>J-N51</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V601N</device_id>
+      <device_name>V601N</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>160</width>
+      <heigh>180</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>65536</color>
+      <emoji_type></emoji_type>
+    </device>
+    <!-- P5 -->
+    <device>
+      <device_id>J-SH53</device_id>
+      <device_name>J-SH53</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>240</width>
+      <heigh>260</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V601SH</device_id>
+      <device_name>V601SH</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>240</width>
+      <heigh>260</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <!-- W -->
+    <device>
+      <device_id>V801SA</device_id>
+      <device_name>V801SA</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>240</width>
+      <heigh>256</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="Vodafone/[^/ ]+/([^/ _]+?)[/ _].+?$">
+    <device>
+      <device_id>V702NK</device_id>
+      <device_name>V702NK</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>176</width>
+      <heigh>208</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V802SE</device_id>
+      <device_name>V802SE</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>176</width>
+      <heigh>220</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <user_agent pattern="MOT-([^/ ]+?)/.+?$">
+    <device>
+      <device_id>C980</device_id>
+      <device_name>702sMO</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>176</width>
+      <heigh>220</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+    <device>
+      <device_id>V980</device_id>
+      <device_name>702MO</device_name>
+      <html_spec_type>JHTML</html_spec_type>
+      <width>176</width>
+      <heigh>220</heigh>
+      <gif>false</gif>
+      <jpeg>true</jpeg>
+      <png>true</png>
+      <bmp2>false</bmp2>
+      <bmp4>false</bmp4>
+      <color>262144</color>
+      <emoji_type></emoji_type>
+    </device>
+  </user_agent>
+  <!--=======================================================================-->
+  <!-- L-mode                                                                -->
+  <!--=======================================================================-->
+  <!--=======================================================================-->
+  <!-- AirH"                                                                 -->
+  <!--=======================================================================-->
+</devices>
+<!--
+vim:ts=2 et
+-->
diff --git a/etc/emoji.xml b/etc/emoji.xml
new file mode 100644 (file)
index 0000000..f7ea5b4
--- /dev/null
@@ -0,0 +1,3172 @@
+<?xml encoding="Shift_JIS" >
+
+<emoji>
+  <set>
+    <no>1</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>9f</hex2>
+      <string>&#63647;</string>
+      <description>\90°\82ê \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>44</A>
+      <B>44</B>
+      <C>44</C>
+      <D>44</D>
+    </ezweb>
+    <jphone>
+      <string>$Gj</string>
+    </jphone>
+  </set>
+  <set>
+    <no>2</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a0</hex2>
+      <string>&#63648;</string>
+      <description>\93Ü\82è \90Â</description>
+    </imode>
+    <ezweb>
+      <A>107</A>
+      <B>107</B>
+      <C>107</C>
+      <D>107</D>
+    </ezweb>
+    <jphone>
+      <string>$Gi</string>
+    </jphone>
+  </set>
+  <set>
+    <no>3</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a1</hex2>
+      <string>&#63649;</string>
+      <description>\89\90Â</description>
+    </imode>
+    <ezweb>
+      <A>95</A>
+      <B>95</B>
+      <C>95</C>
+      <D>95</D>
+    </ezweb>
+    <jphone>
+      <string>$Gk</string>
+    </jphone>
+  </set>
+  <set>
+    <no>4</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a2</hex2>
+      <string>&#63650;</string>
+      <description>\90á \90Â</description>
+    </imode>
+    <ezweb>
+      <A>60</A>
+      <B>60</B>
+      <C>60</C>
+      <D>60</D>
+    </ezweb>
+    <jphone>
+      <string>$Gh</string>
+    </jphone>
+  </set>
+  <set>
+    <no>5</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a3</hex2>
+      <string>&#63651;</string>
+      <description>\97\8b \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>60</A>
+      <B>60</B>
+      <C>60</C>
+      <D>60</D>
+    </ezweb>
+    <jphone>
+      <string>$GU</string>
+    </jphone>
+  </set>
+  <set>
+    <no>6</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a4</hex2>
+      <string>&#63652;</string>
+      <description>\91ä\95\97 \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>190</A>
+      <B>190</B>
+      <C>190</C>
+      <D>190</D>
+    </ezweb>
+    <jphone>
+      <string>$Pc</string>
+    </jphone>
+  </set>
+  <set>
+    <no>7</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a5</hex2>
+      <string>&#63653;</string>
+      <description>\96¶ \90Â</description>
+    </imode>
+    <ezweb>
+      <A>305</A>
+      <B>305</B>
+      <C>305</C>
+      <D>305</D>
+    </ezweb>
+    <jphone>
+      <string>$Gi</string>
+    </jphone>
+  </set>
+  <set>
+    <no>8</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a6</hex2>
+      <string>&#63654;</string>
+      <description>\8f¬\89\90Â</description>
+    </imode>
+    <ezweb>
+      <A>305</A>
+      <B>305</B>
+      <C>305</C>
+      <D>305</D>
+    </ezweb>
+    <jphone>
+      <string>$Gk</string>
+    </jphone>
+  </set>
+  <set>
+    <no>9</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a7</hex2>
+      <string>&#63655;</string>
+      <description>\89²\97r\8dÀ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>192</A>
+      <B>192</B>
+      <C>192</C>
+      <D>192</D>
+    </ezweb>
+    <jphone>
+      <string>$F_</string>
+    </jphone>
+  </set>
+  <set>
+    <no>10</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a8</hex2>
+      <string>&#63656;</string>
+      <description>\89²\8b\8d\8dÀ \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>193</A>
+      <B>193</B>
+      <C>193</C>
+      <D>193</D>
+    </ezweb>
+    <jphone>
+      <string>$F`</string>
+    </jphone>
+  </set>
+  <set>
+    <no>11</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>a9</hex2>
+      <string>&#63657;</string>
+      <description>\91o\8eq\8dÀ \97Î</description>
+    </imode>
+    <ezweb>
+      <A>194</A>
+      <B>194</B>
+      <C>194</C>
+      <D>194</D>
+    </ezweb>
+    <jphone>
+      <string>$Fa</string>
+    </jphone>
+  </set>
+  <set>
+    <no>12</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>aa</hex2>
+      <string>&#63658;</string>
+      <description>\8aI\8dÀ \90Â</description>
+    </imode>
+    <ezweb>
+      <A>195</A>
+      <B>195</B>
+      <C>195</C>
+      <D>195</D>
+    </ezweb>
+    <jphone>
+      <string>$Fb</string>
+    </jphone>
+  </set>
+  <set>
+    <no>13</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ab</hex2>
+      <string>&#63659;</string>
+      <description>\8e\82\8eq\8dÀ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>196</A>
+      <B>196</B>
+      <C>196</C>
+      <D>196</D>
+    </ezweb>
+    <jphone>
+      <string>$Fc</string>
+    </jphone>
+  </set>
+  <set>
+    <no>14</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ac</hex2>
+      <string>&#63660;</string>
+      <description>\89³\8f\97\8dÀ \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>197</A>
+      <B>197</B>
+      <C>197</C>
+      <D>197</D>
+    </ezweb>
+    <jphone>
+      <string>$Fd</string>
+    </jphone>
+  </set>
+  <set>
+    <no>15</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ad</hex2>
+      <string>&#63661;</string>
+      <description>\93V\94\89\8dÀ \97Î</description>
+    </imode>
+    <ezweb>
+      <A>198</A>
+      <B>198</B>
+      <C>198</C>
+      <D>198</D>
+    </ezweb>
+    <jphone>
+      <string>$Fe</string>
+    </jphone>
+  </set>
+  <set>
+    <no>16</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ae</hex2>
+      <string>&#63662;</string>
+      <description>å¶\8dÀ \90Â</description>
+    </imode>
+    <ezweb>
+      <A>199</A>
+      <B>199</B>
+      <C>199</C>
+      <D>199</D>
+    </ezweb>
+    <jphone>
+      <string>$Ff</string>
+    </jphone>
+  </set>
+  <set>
+    <no>17</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>af</hex2>
+      <string>&#63663;</string>
+      <description>\8eË\8eè\8dÀ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>200</A>
+      <B>200</B>
+      <C>200</C>
+      <D>200</D>
+    </ezweb>
+    <jphone>
+      <string>$Fg</string>
+    </jphone>
+  </set>
+  <set>
+    <no>18</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b0</hex2>
+      <string>&#63664;</string>
+      <description>\8eR\97r\8dÀ \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>201</A>
+      <B>201</B>
+      <C>201</C>
+      <D>201</D>
+    </ezweb>
+    <jphone>
+      <string>$Fh</string>
+    </jphone>
+  </set>
+  <set>
+    <no>19</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b1</hex2>
+      <string>&#63665;</string>
+      <description>\90\85\95r\8dÀ \97Î</description>
+    </imode>
+    <ezweb>
+      <A>202</A>
+      <B>202</B>
+      <C>202</C>
+      <D>202</D>
+    </ezweb>
+    <jphone>
+      <string>$Fi</string>
+    </jphone>
+  </set>
+  <set>
+    <no>20</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b2</hex2>
+      <string>&#63666;</string>
+      <description>\8b\9b\8dÀ \90Â</description>
+    </imode>
+    <ezweb>
+      <A>203</A>
+      <B>203</B>
+      <C>203</C>
+      <D>203</D>
+    </ezweb>
+    <jphone>
+      <string>$Fj</string>
+    </jphone>
+  </set>
+  <set>
+    <no>21</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b3</hex2>
+      <string>&#63667;</string>
+      <description>\83X\83|\81[\83\8e\87</description>
+    </imode>
+    <ezweb>
+      <A>219</A>
+      <B>219</B>
+      <C>219</C>
+      <D>219</D>
+    </ezweb>
+    <jphone>
+      <string>$E5</string>
+    </jphone>
+  </set>
+  <set>
+    <no>22</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b4</hex2>
+      <string>&#63668;</string>
+      <description>\96ì\8b\85 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>45</A>
+      <B>45</B>
+      <C>45</C>
+      <D>45</D>
+    </ezweb>
+    <jphone>
+      <string>$G6</string>
+    </jphone>
+  </set>
+  <set>
+    <no>23</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b5</hex2>
+      <string>&#63669;</string>
+      <description>\83S\83\8b\83\90Â</description>
+    </imode>
+    <ezweb>
+      <A>306</A>
+      <B>306</B>
+      <C>306</C>
+      <D>306</D>
+    </ezweb>
+    <jphone>
+      <string>$G4</string>
+    </jphone>
+  </set>
+  <set>
+    <no>24</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b6</hex2>
+      <string>&#63670;</string>
+      <description>\83e\83j\83\97Î</description>
+    </imode>
+    <ezweb>
+      <A>220</A>
+      <B>220</B>
+      <C>220</C>
+      <D>220</D>
+    </ezweb>
+    <jphone>
+      <string>$G5</string>
+    </jphone>
+  </set>
+  <set>
+    <no>25</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b7</hex2>
+      <string>&#63671;</string>
+      <description>\83T\83b\83J\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>219</A>
+      <B>219</B>
+      <C>219</C>
+      <D>219</D>
+    </ezweb>
+    <jphone>
+      <string>$G8</string>
+    </jphone>
+  </set>
+  <set>
+    <no>26</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b8</hex2>
+      <string>&#63672;</string>
+      <description>\83X\83L\81\90Â</description>
+    </imode>
+    <ezweb>
+      <A>221</A>
+      <B>221</B>
+      <C>221</C>
+      <D>221</D>
+    </ezweb>
+    <jphone>
+      <string>$G3</string>
+    </jphone>
+  </set>
+  <set>
+    <no>27</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>b9</hex2>
+      <string>&#63673;</string>
+      <description>\83o\83X\83P\83b\83g\83{\81[\83\8b \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>307</A>
+      <B>307</B>
+      <C>307</C>
+      <D>307</D>
+    </ezweb>
+    <jphone>
+      <string>$PJ</string>
+    </jphone>
+  </set>
+  <set>
+    <no>28</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ba</hex2>
+      <string>&#63674;</string>
+      <description>\83\82\81[\83^\81[\83X\83|\81[\83\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>222</A>
+      <B>222</B>
+      <C>222</C>
+      <D>222</D>
+    </ezweb>
+    <jphone>
+      <string>$ER</string>
+    </jphone>
+  </set>
+  <set>
+    <no>29</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>bb</hex2>
+      <string>&#63675;</string>
+      <description>\83|\83P\83b\83g\83x\83\8b \8e\87</description>
+    </imode>
+    <ezweb>
+      <A>308</A>
+      <B>308</B>
+      <C>308</C>
+      <D>308</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>30</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>bc</hex2>
+      <string>&#63676;</string>
+      <description>\93d\8eÔ \97Î</description>
+    </imode>
+    <ezweb>
+      <A>172</A>
+      <B>172</B>
+      <C>172</C>
+      <D>172</D>
+    </ezweb>
+    <jphone>
+      <string>$G&gt;</string>
+    </jphone>
+  </set>
+  <set>
+    <no>31</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>bd</hex2>
+      <string>&#63677;</string>
+      <description>\92n\89º\93\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>172</A>
+      <B>172</B>
+      <C>172</C>
+      <D>172</D>
+    </ezweb>
+    <jphone>
+      <string>$PT</string>
+    </jphone>
+  </set>
+  <set>
+    <no>32</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>be</hex2>
+      <string>&#63678;</string>
+      <description>\90V\8a²\90ü \90Â</description>
+    </imode>
+    <ezweb>
+      <A>217</A>
+      <B>217</B>
+      <C>217</C>
+      <D>217</D>
+    </ezweb>
+    <jphone>
+      <string>$G?</string>
+    </jphone>
+  </set>
+  <set>
+    <no>33</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>bf</hex2>
+      <string>&#63679;</string>
+      <description>\8eÔ\81i\83Z\83_\83\93\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>125</A>
+      <B>125</B>
+      <C>125</C>
+      <D>125</D>
+    </ezweb>
+    <jphone>
+      <string>$Ez</string>
+    </jphone>
+  </set>
+  <set>
+    <no>34</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c0</hex2>
+      <string>&#63680;</string>
+      <description>\8eÔ\81i\82q\82u\81\97Î</description>
+    </imode>
+    <ezweb>
+      <A>125</A>
+      <B>125</B>
+      <C>125</C>
+      <D>125</D>
+    </ezweb>
+    <jphone>
+      <string>$Ez</string>
+    </jphone>
+  </set>
+  <set>
+    <no>35</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c1</hex2>
+      <string>&#63681;</string>
+      <description>\83o\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>216</A>
+      <B>216</B>
+      <C>216</C>
+      <D>216</D>
+    </ezweb>
+    <jphone>
+      <string>$Ey</string>
+    </jphone>
+  </set>
+  <set>
+    <no>36</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c2</hex2>
+      <string>&#63682;</string>
+      <description>\91\90Â</description>
+    </imode>
+    <ezweb>
+      <A>169</A>
+      <B>169</B>
+      <C>169</C>
+      <D>169</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>37</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c3</hex2>
+      <string>&#63683;</string>
+      <description>\94ò\8ds\8b\90Â</description>
+    </imode>
+    <ezweb>
+      <A>168</A>
+      <B>168</B>
+      <C>168</C>
+      <D>168</D>
+    </ezweb>
+    <jphone>
+      <string>$G=</string>
+    </jphone>
+  </set>
+  <set>
+    <no>38</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c4</hex2>
+      <string>&#63684;</string>
+      <description>\89Æ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>112</A>
+      <B>112</B>
+      <C>112</C>
+      <D>112</D>
+    </ezweb>
+    <jphone>
+      <string>$GV</string>
+    </jphone>
+  </set>
+  <set>
+    <no>39</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c5</hex2>
+      <string>&#63685;</string>
+      <description>\83r\83\8b \90Â</description>
+    </imode>
+    <ezweb>
+      <A>156</A>
+      <B>156</B>
+      <C>156</C>
+      <D>156</D>
+    </ezweb>
+    <jphone>
+      <string>$GX</string>
+    </jphone>
+  </set>
+  <set>
+    <no>40</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c6</hex2>
+      <string>&#63686;</string>
+      <description>\97X\95Ö\8bÇ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>108</A>
+      <B>108</B>
+      <C>108</C>
+      <D>108</D>
+    </ezweb>
+    <jphone>
+      <string>$Es</string>
+    </jphone>
+  </set>
+  <set>
+    <no>41</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c7</hex2>
+      <string>&#63687;</string>
+      <description>\95a\89\90Ô\81^\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>304</A>
+      <B>304</B>
+      <C>304</C>
+      <D>304</D>
+    </ezweb>
+    <jphone>
+      <string>$Eu</string>
+    </jphone>
+  </set>
+  <set>
+    <no>42</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c8</hex2>
+      <string>&#63688;</string>
+      <description>\8bâ\8d\8e\87</description>
+    </imode>
+    <ezweb>
+      <A>212</A>
+      <B>212</B>
+      <C>212</C>
+      <D>212</D>
+    </ezweb>
+    <jphone>
+      <string>$Em</string>
+    </jphone>
+  </set>
+  <set>
+    <no>43</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>c9</hex2>
+      <string>&#63689;</string>
+      <description>\82`\82s\82\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>205</A>
+      <B>205</B>
+      <C>205</C>
+      <D>205</D>
+    </ezweb>
+    <jphone>
+      <string>$Et</string>
+    </jphone>
+  </set>
+  <set>
+    <no>44</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ca</hex2>
+      <string>&#63690;</string>
+      <description>\83z\83e\83\8b \97Î</description>
+    </imode>
+    <ezweb>
+      <A>224</A>
+      <B>224</B>
+      <C>224</C>
+      <D>224</D>
+    </ezweb>
+    <jphone>
+      <string>$Ex</string>
+    </jphone>
+  </set>
+  <set>
+    <no>45</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>cb</hex2>
+      <string>&#63691;</string>
+      <description>\83R\83\93\83r\83\90Â</description>
+    </imode>
+    <ezweb>
+      <A>206</A>
+      <B>206</B>
+      <C>206</C>
+      <D>206</D>
+    </ezweb>
+    <jphone>
+      <string>$Ev</string>
+    </jphone>
+  </set>
+  <set>
+    <no>46</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>cc</hex2>
+      <string>&#63692;</string>
+      <description>\83K\83\\83\8a\83\93\83X\83^\83\93\83\8e\87</description>
+    </imode>
+    <ezweb>
+      <A>213</A>
+      <B>213</B>
+      <C>213</C>
+      <D>213</D>
+    </ezweb>
+    <jphone>
+      <string>$GZ</string>
+    </jphone>
+  </set>
+  <set>
+    <no>47</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>cd</hex2>
+      <string>&#63693;</string>
+      <description>\92\93\8eÔ\8fê \90Â</description>
+    </imode>
+    <ezweb>
+      <A>208</A>
+      <B>208</B>
+      <C>208</C>
+      <D>208</D>
+    </ezweb>
+    <jphone>
+      <string>$Eo</string>
+    </jphone>
+  </set>
+  <set>
+    <no>48</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ce</hex2>
+      <string>&#63694;</string>
+      <description>\90M\8d\86 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>99</A>
+      <B>99</B>
+      <C>99</C>
+      <D>99</D>
+    </ezweb>
+    <jphone>
+      <string>$En</string>
+    </jphone>
+  </set>
+  <set>
+    <no>49</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>cf</hex2>
+      <string>&#63695;</string>
+      <description>\83g\83C\83\8c \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>207</A>
+      <B>207</B>
+      <C>207</C>
+      <D>207</D>
+    </ezweb>
+    <jphone>
+      <string>$Eq</string>
+    </jphone>
+  </set>
+  <set>
+    <no>50</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d0</hex2>
+      <string>&#63696;</string>
+      <description>\83\8c\83X\83g\83\89\83\93 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>146</A>
+      <B>146</B>
+      <C>146</C>
+      <D>146</D>
+    </ezweb>
+    <jphone>
+      <string>$Gc</string>
+    </jphone>
+  </set>
+  <set>
+    <no>51</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d1</hex2>
+      <string>&#63697;</string>
+      <description>\8bi\92\83\93\97Î</description>
+    </imode>
+    <ezweb>
+      <A>93</A>
+      <B>93</B>
+      <C>93</C>
+      <D>93</D>
+    </ezweb>
+    <jphone>
+      <string>$Ge</string>
+    </jphone>
+  </set>
+  <set>
+    <no>52</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d2</hex2>
+      <string>&#63698;</string>
+      <description>\83o\81\8e\87</description>
+    </imode>
+    <ezweb>
+      <A>12</A>
+      <B>12</B>
+      <C>12</C>
+      <D>12</D>
+    </ezweb>
+    <jphone>
+      <string>$Gd</string>
+    </jphone>
+  </set>
+  <set>
+    <no>53</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d3</hex2>
+      <string>&#63699;</string>
+      <description>\83r\81[\83\8b \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>225</A>
+      <B>225</B>
+      <C>225</C>
+      <D>225</D>
+    </ezweb>
+    <jphone>
+      <string>$Gg</string>
+    </jphone>
+  </set>
+  <set>
+    <no>54</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d4</hex2>
+      <string>&#63700;</string>
+      <description>\83t\83@\81[\83X\83g\83t\81[\83\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>245</A>
+      <B>245</B>
+      <C>245</C>
+      <D>245</D>
+    </ezweb>
+    <jphone>
+      <string>$E@</string>
+    </jphone>
+  </set>
+  <set>
+    <no>55</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d5</hex2>
+      <string>&#63701;</string>
+      <description>\83u\83e\83B\83b\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>124</A>
+      <B>124</B>
+      <C>124</C>
+      <D>124</D>
+    </ezweb>
+    <jphone>
+      <string>$E^</string>
+    </jphone>
+  </set>
+  <set>
+    <no>56</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d6</hex2>
+      <string>&#63702;</string>
+      <description>\94ü\97e\89\90Â</description>
+    </imode>
+    <ezweb>
+      <A>104</A>
+      <B>104</B>
+      <C>104</C>
+      <D>104</D>
+    </ezweb>
+    <jphone>
+      <string>$O3</string>
+    </jphone>
+  </set>
+  <set>
+    <no>57</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d7</hex2>
+      <string>&#63703;</string>
+      <description>\83J\83\89\83I\83\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>289</A>
+      <B>289</B>
+      <C>289</C>
+      <D>289</D>
+    </ezweb>
+    <jphone>
+      <string>$G\</string>
+    </jphone>
+  </set>
+  <set>
+    <no>58</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d8</hex2>
+      <string>&#63704;</string>
+      <description>\89f\89æ \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>226</A>
+      <B>226</B>
+      <C>226</C>
+      <D>226</D>
+    </ezweb>
+    <jphone>
+      <string>$G]</string>
+    </jphone>
+  </set>
+  <set>
+    <no>59</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>d9</hex2>
+      <string>&#63705;</string>
+      <description>\89E\8eÎ\82ß\8fã \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>70</A>
+      <B>70</B>
+      <C>70</C>
+      <D>70</D>
+    </ezweb>
+    <jphone>
+      <string>$FV</string>
+    </jphone>
+  </set>
+  <set>
+    <no>60</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>da</hex2>
+      <string>&#63706;</string>
+      <description>\97V\89\80\92\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>223</A>
+      <B>223</B>
+      <C>223</C>
+      <D>223</D>
+    </ezweb>
+    <jphone>
+      <string>$ED</string>
+    </jphone>
+  </set>
+  <set>
+    <no>61</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>db</hex2>
+      <string>&#63707;</string>
+      <description>\89¹\8a\90Â</description>
+    </imode>
+    <ezweb>
+      <A>291</A>
+      <B>291</B>
+      <C>291</C>
+      <D>291</D>
+    </ezweb>
+    <jphone>
+      <string>$G^</string>
+    </jphone>
+  </set>
+  <set>
+    <no>62</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>dc</hex2>
+      <string>&#63708;</string>
+      <description>\83A\81[\83\8e\87</description>
+    </imode>
+    <ezweb>
+      <A>309</A>
+      <B>309</B>
+      <C>309</C>
+      <D>309</D>
+    </ezweb>
+    <jphone>
+      <string>$Q"</string>
+    </jphone>
+  </set>
+  <set>
+    <no>63</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>dd</hex2>
+      <string>&#63709;</string>
+      <description>\89\89\8c\80 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>311</A>
+      <B>311</B>
+      <C>311</C>
+      <D>311</D>
+    </ezweb>
+    <jphone>
+      <string>$Q#</string>
+    </jphone>
+  </set>
+  <set>
+    <no>64</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>de</hex2>
+      <string>&#63710;</string>
+      <description>\83C\83x\83\93\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>311</A>
+      <B>311</B>
+      <C>311</C>
+      <D>311</D>
+    </ezweb>
+    <jphone>
+      <string>$Ec</string>
+    </jphone>
+  </set>
+  <set>
+    <no>65</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>df</hex2>
+      <string>&#63711;</string>
+      <description>\83`\83P\83b\83\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>106</A>
+      <B>106</B>
+      <C>106</C>
+      <D>106</D>
+    </ezweb>
+    <jphone>
+      <string>$EE</string>
+    </jphone>
+  </set>
+  <set>
+    <no>66</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e0</hex2>
+      <string>&#63712;</string>
+      <description>\8bi\89\8c \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>176</A>
+      <B>176</B>
+      <C>176</C>
+      <D>176</D>
+    </ezweb>
+    <jphone>
+      <string>$O.</string>
+    </jphone>
+  </set>
+  <set>
+    <no>67</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e1</hex2>
+      <string>&#63713;</string>
+      <description>\8bÖ\89\8c \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>177</A>
+      <B>177</B>
+      <C>177</C>
+      <D>177</D>
+    </ezweb>
+    <jphone>
+      <string>$F(</string>
+    </jphone>
+  </set>
+  <set>
+    <no>68</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e2</hex2>
+      <string>&#63714;</string>
+      <description>\83J\83\81\83\89 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>94</A>
+      <B>94</B>
+      <C>94</C>
+      <D>94</D>
+    </ezweb>
+    <jphone>
+      <string>$G(</string>
+    </jphone>
+  </set>
+  <set>
+    <no>69</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e3</hex2>
+      <string>&#63715;</string>
+      <description>\83J\83o\83\93 \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>83</A>
+      <B>83</B>
+      <C>83</C>
+      <D>83</D>
+    </ezweb>
+    <jphone>
+      <string>$E&gt;</string>
+    </jphone>
+  </set>
+  <set>
+    <no>70</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e4</hex2>
+      <string>&#63716;</string>
+      <description>\96\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>101</A>
+      <B>101</B>
+      <C>101</C>
+      <D>101</D>
+    </ezweb>
+    <jphone>
+      <string>$Eh</string>
+    </jphone>
+  </set>
+  <set>
+    <no>71</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e5</hex2>
+      <string>&#63717;</string>
+      <description>\83\8a\83{\83\93 \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>312</A>
+      <B>312</B>
+      <C>312</C>
+      <D>312</D>
+    </ezweb>
+    <jphone>
+      <string>$O4</string>
+    </jphone>
+  </set>
+  <set>
+    <no>72</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e6</hex2>
+      <string>&#63718;</string>
+      <description>\83v\83\8c\83[\83\93\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>144</A>
+      <B>144</B>
+      <C>144</C>
+      <D>144</D>
+    </ezweb>
+    <jphone>
+      <string>$E2</string>
+    </jphone>
+  </set>
+  <set>
+    <no>73</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e7</hex2>
+      <string>&#63719;</string>
+      <description>\83o\81[\83X\83f\81\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>313</A>
+      <B>313</B>
+      <C>313</C>
+      <D>313</D>
+    </ezweb>
+    <jphone>
+      <string>$Ok</string>
+    </jphone>
+  </set>
+  <set>
+    <no>74</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e8</hex2>
+      <string>&#63720;</string>
+      <description>\93d\98\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>155</A>
+      <B>155</B>
+      <C>155</C>
+      <D>155</D>
+    </ezweb>
+    <jphone>
+      <string>$G)</string>
+    </jphone>
+  </set>
+  <set>
+    <no>75</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>e9</hex2>
+      <string>&#63721;</string>
+      <description>\8cg\91Ñ\93d\98\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>161</A>
+      <B>161</B>
+      <C>161</C>
+      <D>161</D>
+    </ezweb>
+    <jphone>
+      <string>$G*</string>
+    </jphone>
+  </set>
+  <set>
+    <no>76</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ea</hex2>
+      <string>&#63722;</string>
+      <description>\83\81\83\82 \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>149</A>
+      <B>149</B>
+      <C>149</C>
+      <D>149</D>
+    </ezweb>
+    <jphone>
+      <string>$O!</string>
+    </jphone>
+  </set>
+  <set>
+    <no>77</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>eb</hex2>
+      <string>&#63723;</string>
+      <description>\82s\82\90Â</description>
+    </imode>
+    <ezweb>
+      <A>288</A>
+      <B>288</B>
+      <C>288</C>
+      <D>288</D>
+    </ezweb>
+    <jphone>
+      <string>$EJ</string>
+    </jphone>
+  </set>
+  <set>
+    <no>78</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ec</hex2>
+      <string>&#63724;</string>
+      <description>\83Q\81[\83\80 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>232</A>
+      <B>232</B>
+      <C>232</C>
+      <D>232</D>
+    </ezweb>
+    <jphone>
+      <string>$EK</string>
+    </jphone>
+  </set>
+  <set>
+    <no>79</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ed</hex2>
+      <string>&#63725;</string>
+      <description>\82b\82\90Â</description>
+    </imode>
+    <ezweb>
+      <A>300</A>
+      <B>300</B>
+      <C>300</C>
+      <D>300</D>
+    </ezweb>
+    <jphone>
+      <string>$EF</string>
+    </jphone>
+  </set>
+  <set>
+    <no>80</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ee</hex2>
+      <string>&#63726;</string>
+      <description>\83n\81[\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>51</A>
+      <B>51</B>
+      <C>51</C>
+      <D>51</D>
+    </ezweb>
+    <jphone>
+      <string>$GB</string>
+    </jphone>
+  </set>
+  <set>
+    <no>81</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>ef</hex2>
+      <string>&#63727;</string>
+      <description>\83X\83y\81[\83\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>314</A>
+      <B>314</B>
+      <C>314</C>
+      <D>314</D>
+    </ezweb>
+    <jphone>
+      <string>$F.</string>
+    </jphone>
+  </set>
+  <set>
+    <no>82</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f0</hex2>
+      <string>&#63728;</string>
+      <description>\83_\83C\83\84 \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>315</A>
+      <B>315</B>
+      <C>315</C>
+      <D>315</D>
+    </ezweb>
+    <jphone>
+      <string>$F-</string>
+    </jphone>
+  </set>
+  <set>
+    <no>83</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f1</hex2>
+      <string>&#63729;</string>
+      <description>\83N\83\89\83\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>316</A>
+      <B>316</B>
+      <C>316</C>
+      <D>316</D>
+    </ezweb>
+    <jphone>
+      <string>$F/</string>
+    </jphone>
+  </set>
+  <set>
+    <no>84</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f2</hex2>
+      <string>&#63730;</string>
+      <description>\96Ú \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>317</A>
+      <B>317</B>
+      <C>317</C>
+      <D>317</D>
+    </ezweb>
+    <jphone>
+      <string>$P9</string>
+    </jphone>
+  </set>
+  <set>
+    <no>85</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f3</hex2>
+      <string>&#63731;</string>
+      <description>\8e¨ \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>318</A>
+      <B>318</B>
+      <C>318</C>
+      <D>318</D>
+    </ezweb>
+    <jphone>
+      <string>$P;</string>
+    </jphone>
+  </set>
+  <set>
+    <no>86</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f4</hex2>
+      <string>&#63732;</string>
+      <description>\8eè\81i\83O\81[\81\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>281</A>
+      <B>281</B>
+      <C>281</C>
+      <D>281</D>
+    </ezweb>
+    <jphone>
+      <string>$G-</string>
+    </jphone>
+  </set>
+  <set>
+    <no>87</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f5</hex2>
+      <string>&#63733;</string>
+      <description>\8eè\81i\83`\83\87\83L\81\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>319</A>
+      <B>319</B>
+      <C>319</C>
+      <D>319</D>
+    </ezweb>
+    <jphone>
+      <string>$G1</string>
+    </jphone>
+  </set>
+  <set>
+    <no>88</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f6</hex2>
+      <string>&#63734;</string>
+      <description>\8eè\81i\83p\81[\81\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>320</A>
+      <B>320</B>
+      <C>320</C>
+      <D>320</D>
+    </ezweb>
+    <jphone>
+      <string>$G2</string>
+    </jphone>
+  </set>
+  <set>
+    <no>89</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f7</hex2>
+      <string>&#63735;</string>
+      <description>\89E\8eÎ\82ß\89º \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>43</A>
+      <B>43</B>
+      <C>43</C>
+      <D>43</D>
+    </ezweb>
+    <jphone>
+      <string>$FX</string>
+    </jphone>
+  </set>
+  <set>
+    <no>90</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f8</hex2>
+      <string>&#63736;</string>
+      <description>\8d\8eÎ\82ß\8fã \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>42</A>
+      <B>42</B>
+      <C>42</C>
+      <D>42</D>
+    </ezweb>
+    <jphone>
+      <string>$FW</string>
+    </jphone>
+  </set>
+  <set>
+    <no>91</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>f9</hex2>
+      <string>&#63737;</string>
+      <description>\91« \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>124</A>
+      <B>124</B>
+      <C>276</C>
+      <D>276</D>
+    </ezweb>
+    <jphone>
+      <string>$QV</string>
+    </jphone>
+  </set>
+  <set>
+    <no>92</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>fa</hex2>
+      <string>&#63738;</string>
+      <description>\82­\82 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>124</A>
+      <B>124</B>
+      <C>124</C>
+      <D>124</D>
+    </ezweb>
+    <jphone>
+      <string>$G'</string>
+    </jphone>
+  </set>
+  <set>
+    <no>93</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>fb</hex2>
+      <string>&#63739;</string>
+      <description>\8aá\8b¾ \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>116</A>
+      <B>116</B>
+      <C>116</C>
+      <D>116</D>
+    </ezweb>
+    <jphone>
+      <string>$F1</string>
+    </jphone>
+  </set>
+  <set>
+    <no>94</no>
+    <imode>
+      <hex1>f8</hex1>
+      <hex2>fc</hex2>
+      <string>&#63740;</string>
+      <description>\8eÔ\88Ö\8e\90Â</description>
+    </imode>
+    <ezweb>
+      <A>178</A>
+      <B>178</B>
+      <C>178</C>
+      <D>178</D>
+    </ezweb>
+    <jphone>
+      <string>$F*</string>
+    </jphone>
+  </set>
+  <set>
+    <no>95</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>40</hex2>
+      <string>&#63808;</string>
+      <description>\90V\8c\8e \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>15</A>
+      <B>15</B>
+      <C>321</C>
+      <D>321</D>
+    </ezweb>
+    <jphone>
+      <string>$Gl</string>
+    </jphone>
+  </set>
+  <set>
+    <no>96</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>41</hex2>
+      <string>&#63809;</string>
+      <description>\82â\82â\8c\87\82¯\8c\8e \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>15</A>
+      <B>15</B>
+      <C>322</C>
+      <D>322</D>
+    </ezweb>
+    <jphone>
+      <string>$Gl</string>
+    </jphone>
+  </set>
+  <set>
+    <no>97</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>42</hex2>
+      <string>&#63810;</string>
+      <description>\94¼\8c\8e \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>15</A>
+      <B>15</B>
+      <C>323</C>
+      <D>323</D>
+    </ezweb>
+    <jphone>
+      <string>$Gl</string>
+    </jphone>
+  </set>
+  <set>
+    <no>98</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>43</hex2>
+      <string>&#63811;</string>
+      <description>\8eO\93ú\8c\8e \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>15</A>
+      <B>15</B>
+      <C>15</C>
+      <D>15</D>
+    </ezweb>
+    <jphone>
+      <string>$Gl</string>
+    </jphone>
+  </set>
+  <set>
+    <no>99</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>44</hex2>
+      <string>&#63812;</string>
+      <description>\96\9e\8c\8e \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>15</A>
+      <B>15</B>
+      <C>15</C>
+      <D>15</D>
+    </ezweb>
+    <jphone>
+      <string>$Gl</string>
+    </jphone>
+  </set>
+  <set>
+    <no>100</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>45</hex2>
+      <string>&#63813;</string>
+      <description>\8c¢ \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>134</A>
+      <B>134</B>
+      <C>134</C>
+      <D>134</D>
+    </ezweb>
+    <jphone>
+      <string>$Gr</string>
+    </jphone>
+  </set>
+  <set>
+    <no>101</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>46</hex2>
+      <string>&#63814;</string>
+      <description>\94\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>251</A>
+      <B>251</B>
+      <C>251</C>
+      <D>251</D>
+    </ezweb>
+    <jphone>
+      <string>$Go</string>
+    </jphone>
+  </set>
+  <set>
+    <no>102</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>47</hex2>
+      <string>&#63815;</string>
+      <description>\83\8a\83]\81[\83\90Â</description>
+    </imode>
+    <ezweb>
+      <A>169</A>
+      <B>169</B>
+      <C>169</C>
+      <D>169</D>
+    </ezweb>
+    <jphone>
+      <string>$G&lt;</string>
+    </jphone>
+  </set>
+  <set>
+    <no>103</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>48</hex2>
+      <string>&#63816;</string>
+      <description>\83N\83\8a\83X\83}\83\97Î</description>
+    </imode>
+    <ezweb>
+      <A>234</A>
+      <B>234</B>
+      <C>234</C>
+      <D>234</D>
+    </ezweb>
+    <jphone>
+      <string>$GS</string>
+    </jphone>
+  </set>
+  <set>
+    <no>104</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>49</hex2>
+      <string>&#63817;</string>
+      <description>\8d\8eÎ\82ß\89º \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>71</A>
+      <B>71</B>
+      <C>71</C>
+      <D>71</D>
+    </ezweb>
+    <jphone>
+      <string>$FY</string>
+    </jphone>
+  </set>
+  <set>
+    <no>105</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>72</hex2>
+      <string>&#63858;</string>
+      <description>phone to \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>161</A>
+      <B>161</B>
+      <C>161</C>
+      <D>161</D>
+    </ezweb>
+    <jphone>
+      <string>$E$</string>
+    </jphone>
+  </set>
+  <set>
+    <no>106</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>73</hex2>
+      <string>&#63859;</string>
+      <description>mail to \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>151</A>
+      <B>151</B>
+      <C>151</C>
+      <D>151</D>
+    </ezweb>
+    <jphone>
+      <string>$E#</string>
+    </jphone>
+  </set>
+  <set>
+    <no>107</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>74</hex2>
+      <string>&#63860;</string>
+      <description>fax to \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>166</A>
+      <B>166</B>
+      <C>166</C>
+      <D>166</D>
+    </ezweb>
+    <jphone>
+      <string>$G+</string>
+    </jphone>
+  </set>
+  <set>
+    <no>108</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>75</hex2>
+      <string>&#63861;</string>
+      <description>i\83\82\81[\83\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>298</A>
+      <B>298</B>
+      <C>298</C>
+      <D>298</D>
+    </ezweb>
+    <jphone>
+      <string>$Fu</string>
+    </jphone>
+  </set>
+  <set>
+    <no>109</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>76</hex2>
+      <string>&#63862;</string>
+      <description>i\83\82\81[\83h\81i\98g\95t\82«\81\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>298</A>
+      <B>298</B>
+      <C>298</C>
+      <D>298</D>
+    </ezweb>
+    <jphone>
+      <string>$Fu</string>
+    </jphone>
+  </set>
+  <set>
+    <no>110</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>77</hex2>
+      <string>&#63863;</string>
+      <description>\83\81\81[\83\8b \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>108</A>
+      <B>108</B>
+      <C>108</C>
+      <D>108</D>
+    </ezweb>
+    <jphone>
+      <string>$E#</string>
+    </jphone>
+  </set>
+  <set>
+    <no>111</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>78</hex2>
+      <string>&#63864;</string>
+      <description>\83h\83R\83\82\92ñ\8b\9f \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>298</A>
+      <B>298</B>
+      <C>298</C>
+      <D>298</D>
+    </ezweb>
+    <jphone>
+      <string>$Fu</string>
+    </jphone>
+  </set>
+  <set>
+    <no>112</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>79</hex2>
+      <string>&#63865;</string>
+      <description>\83h\83R\83\82\83|\83C\83\93\83\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>298</A>
+      <B>298</B>
+      <C>298</C>
+      <D>298</D>
+    </ezweb>
+    <jphone>
+      <string>$Fu</string>
+    </jphone>
+  </set>
+  <set>
+    <no>113</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>7a</hex2>
+      <string>&#63866;</string>
+      <description>\97L\97¿ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>109</A>
+      <B>109</B>
+      <C>109</C>
+      <D>109</D>
+    </ezweb>
+    <jphone>
+      <string>$F5</string>
+    </jphone>
+  </set>
+  <set>
+    <no>114</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>7b</hex2>
+      <string>&#63867;</string>
+      <description>\96³\97¿ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>299</A>
+      <B>299</B>
+      <C>299</C>
+      <D>299</D>
+    </ezweb>
+    <jphone>
+      <string>$F6</string>
+    </jphone>
+  </set>
+  <set>
+    <no>115</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>7c</hex2>
+      <string>&#63868;</string>
+      <description>ID \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>138</A>
+      <B>138</B>
+      <C>138</C>
+      <D>138</D>
+    </ezweb>
+    <jphone>
+      <string>$FI</string>
+    </jphone>
+  </set>
+  <set>
+    <no>116</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>7d</hex2>
+      <string>&#63869;</string>
+      <description>\83p\83X\83\8f\81[\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>120</A>
+      <B>120</B>
+      <C>120</C>
+      <D>120</D>
+    </ezweb>
+    <jphone>
+      <string>$G_</string>
+    </jphone>
+  </set>
+  <set>
+    <no>117</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>7e</hex2>
+      <string>&#63870;</string>
+      <description>\8e\9f\8d\80\97\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>118</A>
+      <B>118</B>
+      <C>118</C>
+      <D>118</D>
+    </ezweb>
+    <jphone>
+      <string>$FZ</string>
+    </jphone>
+  </set>
+  <set>
+    <no>118</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>80</hex2>
+      <string>&#63872;</string>
+      <description>\83N\83\8a\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>324</A>
+      <B>324</B>
+      <C>324</C>
+      <D>324</D>
+    </ezweb>
+    <jphone>
+      <string>$Gz</string>
+    </jphone>
+  </set>
+  <set>
+    <no>119</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>81</hex2>
+      <string>&#63873;</string>
+      <description>\83T\81[\83`\81i\92²\82×\82é\81\90Â</description>
+    </imode>
+    <ezweb>
+      <A>119</A>
+      <B>119</B>
+      <C>119</C>
+      <D>119</D>
+    </ezweb>
+    <jphone>
+      <string>$E4</string>
+    </jphone>
+  </set>
+  <set>
+    <no>120</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>82</hex2>
+      <string>&#63874;</string>
+      <description>\82m\82d\82\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>334</A>
+      <B>334</B>
+      <C>334</C>
+      <D>334</D>
+    </ezweb>
+    <jphone>
+      <string>$F2</string>
+    </jphone>
+  </set>
+  <set>
+    <no>121</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>83</hex2>
+      <string>&#63875;</string>
+      <description>\88Ê\92u\8fî\95ñ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>210</A>
+      <B>210</B>
+      <C>210</C>
+      <D>210</D>
+    </ezweb>
+    <jphone>
+      <string>$Ek</string>
+    </jphone>
+  </set>
+  <set>
+    <no>122</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>84</hex2>
+      <string>&#63876;</string>
+      <description>\83t\83\8a\81[\83_\83C\83\84\83\8b \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>155</A>
+      <B>155</B>
+      <C>155</C>
+      <D>155</D>
+    </ezweb>
+    <jphone>
+      <string>$F1</string>
+    </jphone>
+  </set>
+  <set>
+    <no>123</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>85</hex2>
+      <string>&#63877;</string>
+      <description>\83V\83\83\81[\83v\83_\83C\83\84\83\8b \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>155</A>
+      <B>155</B>
+      <C>155</C>
+      <D>155</D>
+    </ezweb>
+    <jphone>
+      <string>$F0</string>
+    </jphone>
+  </set>
+  <set>
+    <no>124</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>86</hex2>
+      <string>&#63878;</string>
+      <description>\83\82\83o\82\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>155</A>
+      <B>155</B>
+      <C>155</C>
+      <D>155</D>
+    </ezweb>
+    <jphone>
+      <string>$Ft</string>
+    </jphone>
+  </set>
+  <set>
+    <no>125</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>87</hex2>
+      <string>&#63879;</string>
+      <description>1 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>180</A>
+      <B>180</B>
+      <C>180</C>
+      <D>180</D>
+    </ezweb>
+    <jphone>
+      <string>$F&lt;</string>
+    </jphone>
+  </set>
+  <set>
+    <no>126</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>88</hex2>
+      <string>&#63880;</string>
+      <description>2 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>181</A>
+      <B>181</B>
+      <C>181</C>
+      <D>181</D>
+    </ezweb>
+    <jphone>
+      <string>$F=</string>
+    </jphone>
+  </set>
+  <set>
+    <no>127</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>89</hex2>
+      <string>&#63881;</string>
+      <description>3 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>182</A>
+      <B>182</B>
+      <C>182</C>
+      <D>182</D>
+    </ezweb>
+    <jphone>
+      <string>$F&gt;</string>
+    </jphone>
+  </set>
+  <set>
+    <no>128</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>8a</hex2>
+      <string>&#63882;</string>
+      <description>4 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>183</A>
+      <B>183</B>
+      <C>183</C>
+      <D>183</D>
+    </ezweb>
+    <jphone>
+      <string>$F?</string>
+    </jphone>
+  </set>
+  <set>
+    <no>129</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>8b</hex2>
+      <string>&#63883;</string>
+      <description>5 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>184</A>
+      <B>184</B>
+      <C>184</C>
+      <D>184</D>
+    </ezweb>
+    <jphone>
+      <string>$F@</string>
+    </jphone>
+  </set>
+  <set>
+    <no>130</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>8c</hex2>
+      <string>&#63884;</string>
+      <description>6 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>185</A>
+      <B>185</B>
+      <C>185</C>
+      <D>185</D>
+    </ezweb>
+    <jphone>
+      <string>$FA</string>
+    </jphone>
+  </set>
+  <set>
+    <no>131</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>8d</hex2>
+      <string>&#63885;</string>
+      <description>7 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>186</A>
+      <B>186</B>
+      <C>186</C>
+      <D>186</D>
+    </ezweb>
+    <jphone>
+      <string>$FB</string>
+    </jphone>
+  </set>
+  <set>
+    <no>132</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>8e</hex2>
+      <string>&#63886;</string>
+      <description>8 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>187</A>
+      <B>187</B>
+      <C>187</C>
+      <D>187</D>
+    </ezweb>
+    <jphone>
+      <string>$FC</string>
+    </jphone>
+  </set>
+  <set>
+    <no>133</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>8f</hex2>
+      <string>&#63887;</string>
+      <description>9 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>188</A>
+      <B>188</B>
+      <C>188</C>
+      <D>188</D>
+    </ezweb>
+    <jphone>
+      <string>$FD</string>
+    </jphone>
+  </set>
+  <set>
+    <no>134</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>90</hex2>
+      <string>&#63888;</string>
+      <description>0 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>325</A>
+      <B>325</B>
+      <C>325</C>
+      <D>325</D>
+    </ezweb>
+    <jphone>
+      <string>$FE</string>
+    </jphone>
+  </set>
+  <set>
+    <no>135</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>b0</hex2>
+      <string>&#63920;</string>
+      <description>\8c\88\92è \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>326</A>
+      <B>326</B>
+      <C>326</C>
+      <D>326</D>
+    </ezweb>
+    <jphone>
+      <string>$Fm</string>
+    </jphone>
+  </set>
+  <set>
+    <no>136</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>91</hex2>
+      <string>&#63889;</string>
+      <description>\8d\95\83n\81[\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>51</A>
+      <B>51</B>
+      <C>51</C>
+      <D>51</D>
+    </ezweb>
+    <jphone>
+      <string>$GB</string>
+    </jphone>
+  </set>
+  <set>
+    <no>137</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>92</hex2>
+      <string>&#63890;</string>
+      <description>\97h\82ê\82é\83n\81[\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>51</A>
+      <B>51</B>
+      <C>328</C>
+      <D>328</D>
+    </ezweb>
+    <jphone>
+      <string>$GB</string>
+    </jphone>
+  </set>
+  <set>
+    <no>138</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>93</hex2>
+      <string>&#63891;</string>
+      <description>\8e¸\97ö \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>265</A>
+      <B>265</B>
+      <C>265</C>
+      <D>265</D>
+    </ezweb>
+    <jphone>
+      <string>$GC</string>
+    </jphone>
+  </set>
+  <set>
+    <no>139</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>94</hex2>
+      <string>&#63892;</string>
+      <description>\83n\81[\83g\82½\82¿\81i\95¡\90\94\83n\81[\83g\81\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>15</A>
+      <B>15</B>
+      <C>266</C>
+      <D>266</D>
+    </ezweb>
+    <jphone>
+      <string>$GB</string>
+    </jphone>
+  </set>
+  <set>
+    <no>140</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>95</hex2>
+      <string>&#63893;</string>
+      <description>\82í\81[\82¢\81i\8að\82µ\82¢\8aç\81\8e\87</description>
+    </imode>
+    <ezweb>
+      <A>257</A>
+      <B>257</B>
+      <C>257</C>
+      <D>257</D>
+    </ezweb>
+    <jphone>
+      <string>$Gw</string>
+    </jphone>
+  </set>
+  <set>
+    <no>141</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>96</hex2>
+      <string>&#63894;</string>
+      <description>\82¿\82Á\81i\93{\82Á\82½\8aç\81\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>258</A>
+      <B>258</B>
+      <C>258</C>
+      <D>258</D>
+    </ezweb>
+    <jphone>
+      <string>$Gy</string>
+    </jphone>
+  </set>
+  <set>
+    <no>142</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>97</hex2>
+      <string>&#63895;</string>
+      <description>\82ª\82­\81`\81i\97\8e\92_\82µ\82½\8aç\81\90Â</description>
+    </imode>
+    <ezweb>
+      <A>260</A>
+      <B>260</B>
+      <C>260</C>
+      <D>260</D>
+    </ezweb>
+    <jphone>
+      <string>$Gx</string>
+    </jphone>
+  </set>
+  <set>
+    <no>143</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>98</hex2>
+      <string>&#63896;</string>
+      <description>\82à\82¤\82â\82¾\81`\81i\94ß\82µ\82¢\8aç\81\97Î</description>
+    </imode>
+    <ezweb>
+      <A>259</A>
+      <B>259</B>
+      <C>259</C>
+      <D>259</D>
+    </ezweb>
+    <jphone>
+      <string>$E'</string>
+    </jphone>
+  </set>
+  <set>
+    <no>144</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>99</hex2>
+      <string>&#63897;</string>
+      <description>\82Ó\82ç\82Ó\82ç \90Â</description>
+    </imode>
+    <ezweb>
+      <A>327</A>
+      <B>327</B>
+      <C>327</C>
+      <D>327</D>
+    </ezweb>
+    <jphone>
+      <string>$E(</string>
+    </jphone>
+  </set>
+  <set>
+    <no>145</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>9a</hex2>
+      <string>&#63898;</string>
+      <description>\83O\83b\83h\81i\8fã\8cü\82«\96î\88ó\81\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>29</A>
+      <B>29</B>
+      <C>29</C>
+      <D>29</D>
+    </ezweb>
+    <jphone>
+      <string>$FR</string>
+    </jphone>
+  </set>
+  <set>
+    <no>146</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>9b</hex2>
+      <string>&#63899;</string>
+      <description>\82é\82ñ\82é\82ñ \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>291</A>
+      <B>291</B>
+      <C>291</C>
+      <D>291</D>
+    </ezweb>
+    <jphone>
+      <string>$G^</string>
+    </jphone>
+  </set>
+  <set>
+    <no>147</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>9c</hex2>
+      <string>&#63900;</string>
+      <description>\82¢\82¢\8bC\95ª\81i\89·\90ò\81\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>224</A>
+      <B>224</B>
+      <C>224</C>
+      <D>224</D>
+    </ezweb>
+    <jphone>
+      <string>$EC</string>
+    </jphone>
+  </set>
+  <set>
+    <no>148</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>9d</hex2>
+      <string>&#63901;</string>
+      <description>\82©\82í\82¢\82¢ \8e\87</description>
+    </imode>
+    <ezweb>
+      <A>51</A>
+      <B>51</B>
+      <C>51</C>
+      <D>51</D>
+    </ezweb>
+    <jphone>
+      <string>$GB</string>
+    </jphone>
+  </set>
+  <set>
+    <no>149</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>9e</hex2>
+      <string>&#63902;</string>
+      <description>\83L\83X\83}\81[\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>273</A>
+      <B>273</B>
+      <C>273</C>
+      <D>273</D>
+    </ezweb>
+    <jphone>
+      <string>$G#</string>
+    </jphone>
+  </set>
+  <set>
+    <no>150</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>9f</hex2>
+      <string>&#63903;</string>
+      <description>\82Ò\82©\82Ò\82©\81i\90V\82µ\82¢\81\83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>20</A>
+      <B>20</B>
+      <C>267</C>
+      <D>267</D>
+    </ezweb>
+    <jphone>
+      <string>$GU</string>
+    </jphone>
+  </set>
+  <set>
+    <no>151</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a0</hex2>
+      <string>&#63904;</string>
+      <description>\82Ð\82ç\82ß\82« \83I\83\8c\83\93\83W</description>
+    </imode>
+    <ezweb>
+      <A>77</A>
+      <B>77</B>
+      <C>77</C>
+      <D>77</D>
+    </ezweb>
+    <jphone>
+      <string>$E/</string>
+    </jphone>
+  </set>
+  <set>
+    <no>152</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a1</hex2>
+      <string>&#63905;</string>
+      <description>\82Þ\82©\82Á\81i\93{\82è\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>262</A>
+      <B>262</B>
+      <C>262</C>
+      <D>262</D>
+    </ezweb>
+    <jphone>
+      <string>$Gy</string>
+    </jphone>
+  </set>
+  <set>
+    <no>153</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a2</hex2>
+      <string>&#63906;</string>
+      <description>\83p\83\93\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>281</A>
+      <B>281</B>
+      <C>281</C>
+      <D>281</D>
+    </ezweb>
+    <jphone>
+      <string>$G-</string>
+    </jphone>
+  </set>
+  <set>
+    <no>154</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a3</hex2>
+      <string>&#63907;</string>
+      <description>\94\9a\92\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>268</A>
+      <B>268</B>
+      <C>268</C>
+      <D>268</D>
+    </ezweb>
+    <jphone>
+      <string>$O1</string>
+    </jphone>
+  </set>
+  <set>
+    <no>155</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a4</hex2>
+      <string>&#63908;</string>
+      <description>\83\80\81[\83\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>291</A>
+      <B>291</B>
+      <C>291</C>
+      <D>291</D>
+    </ezweb>
+    <jphone>
+      <string>$G^</string>
+    </jphone>
+  </set>
+  <set>
+    <no>156</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a5</hex2>
+      <string>&#63909;</string>
+      <description>\83o\83b\83h\81i\89º\8cü\82«\96î\88ó\81\90Â</description>
+    </imode>
+    <ezweb>
+      <A>30</A>
+      <B>30</B>
+      <C>30</C>
+      <D>30</D>
+    </ezweb>
+    <jphone>
+      <string>$FS</string>
+    </jphone>
+  </set>
+  <set>
+    <no>157</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a6</hex2>
+      <string>&#63910;</string>
+      <description>\96°\82¢(\90\87\96°) \90Â</description>
+    </imode>
+    <ezweb>
+      <A>261</A>
+      <B>261</B>
+      <C>261</C>
+      <D>261</D>
+    </ezweb>
+    <jphone>
+      <string>$E\</string>
+    </jphone>
+  </set>
+  <set>
+    <no>158</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a7</hex2>
+      <string>&#63911;</string>
+      <description>exclamation \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>2</A>
+      <B>2</B>
+      <C>2</C>
+      <D>2</D>
+    </ezweb>
+    <jphone>
+      <string>$GA</string>
+    </jphone>
+  </set>
+  <set>
+    <no>159</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a8</hex2>
+      <string>&#63912;</string>
+      <description>exclamation&question \8e\87</description>
+    </imode>
+    <ezweb>
+      <A>3</A>
+      <B>3</B>
+      <C>3</C>
+      <D>3</D>
+    </ezweb>
+    <jphone>
+      <string>$G@</string>
+    </jphone>
+  </set>
+  <set>
+    <no>160</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>a9</hex2>
+      <string>&#63913;</string>
+      <description>exclamation\81~2 \90Ô</description>
+    </imode>
+    <ezweb>
+      <A>2</A>
+      <B>2</B>
+      <C>2</C>
+      <D>2</D>
+    </ezweb>
+    <jphone>
+      <string>$GA</string>
+    </jphone>
+  </set>
+  <set>
+    <no>161</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>aa</hex2>
+      <string>&#63914;</string>
+      <description>\82Ç\82ñ\82Á\81i\8fÕ\8c\82\81\90Ô</description>
+    </imode>
+    <ezweb>
+      <A>329</A>
+      <B>329</B>
+      <C>329</C>
+      <D>329</D>
+    </ezweb>
+    <jphone>
+      <string>$Ft</string>
+    </jphone>
+  </set>
+  <set>
+    <no>162</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>ab</hex2>
+      <string>&#63915;</string>
+      <description>\82 \82¹\82 \82¹\81i\94ò\82Ñ\8eU\82é\8a¾\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>330</A>
+      <B>330</B>
+      <C>330</C>
+      <D>330</D>
+    </ezweb>
+    <jphone>
+      <string>$E(</string>
+    </jphone>
+  </set>
+  <set>
+    <no>163</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>ac</hex2>
+      <string>&#63916;</string>
+      <description>\82½\82ç\81[\82Á\81i\8a¾\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>263</A>
+      <B>263</B>
+      <C>263</C>
+      <D>263</D>
+    </ezweb>
+    <jphone>
+      <string>$E(</string>
+    </jphone>
+  </set>
+  <set>
+    <no>164</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>ad</hex2>
+      <string>&#63917;</string>
+      <description>\83_\83b\83V\83\85\81i\91\96\82è\8fo\82·\82³\82Ü\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>282</A>
+      <B>282</B>
+      <C>282</C>
+      <D>282</D>
+    </ezweb>
+    <jphone>
+      <string>$E5</string>
+    </jphone>
+  </set>
+  <set>
+    <no>165</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>ae</hex2>
+      <string>&#63918;</string>
+      <description>\81[\81i\92·\89¹\8bL\8d\86\82P\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>0</A>
+      <B>0</B>
+      <C>0</C>
+      <D>0</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>166</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>af</hex2>
+      <string>&#63919;</string>
+      <description>\81[\81i\92·\89¹\8bL\8d\86\82Q\81\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>0</A>
+      <B>0</B>
+      <C>0</C>
+      <D>0</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>167</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>50</hex2>
+      <string>&#63824;</string>
+      <description>\83J\83`\83\93\83\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>226</A>
+      <B>226</B>
+      <C>226</C>
+      <D>226</D>
+    </ezweb>
+    <jphone>
+      <string>$OD</string>
+    </jphone>
+  </set>
+  <set>
+    <no>168</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>51</hex2>
+      <string>&#63825;</string>
+      <description>\82Ó\82­\82ë \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>233</A>
+      <B>233</B>
+      <C>233</C>
+      <D>233</D>
+    </ezweb>
+    <jphone>
+      <string>$EO</string>
+    </jphone>
+  </set>
+  <set>
+    <no>169</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>52</hex2>
+      <string>&#63826;</string>
+      <description>\83y\83\93 \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>149</A>
+      <B>149</B>
+      <C>149</C>
+      <D>149</D>
+    </ezweb>
+    <jphone>
+      <string>$O!</string>
+    </jphone>
+  </set>
+  <set>
+    <no>170</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>55</hex2>
+      <string>&#63829;</string>
+      <description>\90l\89\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>236</A>
+      <B>236</B>
+      <C>236</C>
+      <D>236</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>171</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>56</hex2>
+      <string>&#63830;</string>
+      <description>\82¢\82· \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>0</A>
+      <B>0</B>
+      <C>0</C>
+      <D>0</D>
+    </ezweb>
+    <jphone>
+      <string>$E?</string>
+    </jphone>
+  </set>
+  <set>
+    <no>172</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>57</hex2>
+      <string>&#63831;</string>
+      <description>\96é \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>47</A>
+      <B>47</B>
+      <C>47</C>
+      <D>47</D>
+    </ezweb>
+    <jphone>
+      <string>$Gl</string>
+    </jphone>
+  </set>
+  <set>
+    <no>173</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>5b</hex2>
+      <string>&#63835;</string>
+      <description>soon \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>105</A>
+      <B>105</B>
+      <C>105</C>
+      <D>105</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>174</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>5c</hex2>
+      <string>&#63836;</string>
+      <description>on \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>0</A>
+      <B>0</B>
+      <C>0</C>
+      <D>0</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>175</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>5d</hex2>
+      <string>&#63837;</string>
+      <description>end \8d\95</description>
+    </imode>
+    <ezweb>
+      <A>0</A>
+      <B>0</B>
+      <C>0</C>
+      <D>0</D>
+    </ezweb>
+    <jphone>
+      <string></string>
+    </jphone>
+  </set>
+  <set>
+    <no>176</no>
+    <imode>
+      <hex1>f9</hex1>
+      <hex2>5e</hex2>
+      <string>&#63838;</string>
+      <description>\8e\9e\8c\8d\95</description>
+    </imode>
+    <ezweb>
+      <A>46</A>
+      <B>46</B>
+      <C>46</C>
+      <D>46</D>
+    </ezweb>
+    <jphone>
+      <string>$GD</string>
+    </jphone>
+  </set>
+</emoji>
diff --git a/java/build.properties b/java/build.properties
new file mode 100644 (file)
index 0000000..8f88b53
--- /dev/null
@@ -0,0 +1 @@
+catalina.home=/usr/local/tomcat5
diff --git a/java/build.xml b/java/build.xml
new file mode 100644 (file)
index 0000000..216fab8
--- /dev/null
@@ -0,0 +1,55 @@
+<project name="" default="build" basedir=".">
+
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+
+    <property name="app.name" value="chxjfilter" />
+    <property name="app.version" value="0.0.1" />
+
+    <property name="catalina.home" value="/usr/local/tomcat" /> <!-- UPDATE THIS! -->
+
+    <property name="src.home" value="src" />
+    <property name="lib.home" value="lib" />
+
+    <property name="build.home" value="build" />
+    <property name="dist.home" value="dist" />
+
+    <property name="encoding" value="Shift_JIS" />
+
+    <path id="compile.classpath">
+        <!-- Include all elements that Tomcat exposes to applications -->
+       <pathelement location="${catalina.home}/common/classes" />
+        <fileset dir="${catalina.home}/common/endorsed">
+            <include name="*.jar" />
+        </fileset>
+        <fileset dir="${catalina.home}/common/lib">
+            <include name="*.jar" />
+        </fileset>
+        <pathelement location="${catalina.home}/shared/classes" />
+        <fileset dir="${catalina.home}/shared/lib">
+            <include name="*.jar" />
+        </fileset>
+    </path>
+
+    <target name="build">
+        <mkdir dir="${build.home}" />
+        <javac srcdir="${src.home}"
+            destdir="${build.home}"
+            encoding="${encoding}"
+            debug="on">
+            <classpath refid="compile.classpath" />
+        </javac>
+    </target>
+
+    <target name="dist" depends="build">
+        <mkdir dir="${dist.home}" />
+        <jar jarfile="${dist.home}/${app.name}-${app.version}.jar"
+            basedir="${build.home}" />
+    </target>
+
+    <target name="clean">
+        <delete dir="${dist.home}" />
+        <delete dir="${build.home}" />
+    </target>
+
+</project>
diff --git a/java/src/com/qsdn/filter/CHXJFilter.java b/java/src/com/qsdn/filter/CHXJFilter.java
new file mode 100644 (file)
index 0000000..3187306
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.qsdn.filter;
+
+
+import java.io.IOException;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * CHXJFilter for mod_chxj
+ *
+ * converter for _chxj_c_ or _chxj_r_ prefix parameter.
+ *
+ * @author Atsushi Konno <konno@qsdn.co.jp>
+ */
+public class CHXJFilter
+  implements Filter 
+{
+  private String enc;
+  private boolean ignore = false;
+  private boolean decodeHttpGetParameter = true;
+
+  public void destroy() 
+  {
+  }
+
+  public void doFilter(
+    ServletRequest request,
+    ServletResponse response,
+    FilterChain chain)
+    throws IOException, ServletException 
+  {
+    CHXJRequestWrapper chxjRequest = new CHXJRequestWrapper((HttpServletRequest)request);
+    chain.doFilter(chxjRequest, response);
+  }
+
+  public void init(FilterConfig config)
+    throws ServletException 
+  {
+    enc = config.getInitParameter("encoding");
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/java/src/com/qsdn/filter/CHXJRequestWrapper.java b/java/src/com/qsdn/filter/CHXJRequestWrapper.java
new file mode 100644 (file)
index 0000000..1987ecd
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.qsdn.filter;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Iterator;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+public class CHXJRequestWrapper 
+  extends HttpServletRequestWrapper 
+{
+  private class ParamNameEnumeration 
+    implements Enumeration 
+  {
+    private Iterator iterator;
+
+    private ParamNameEnumeration(Map map) 
+    {
+      if (map == null)
+      {
+        iterator = new LinkedList().iterator();
+      }
+      else
+      {
+        iterator = map.keySet().iterator();
+      }
+    }
+
+    public boolean hasMoreElements() 
+    {
+      return iterator.hasNext();
+    }
+
+    public Object nextElement() 
+    {
+      return iterator.next();
+    }
+  }
+
+
+  public CHXJRequestWrapper(HttpServletRequest request) 
+  {
+    super(request);
+  }
+
+  public String getQueryString() 
+  {
+    String queryString = super.getQueryString();
+    if (queryString == null)
+    {
+      return null;
+    }
+    StringBuffer newQueryString = new StringBuffer();
+
+    StringTokenizer st = new StringTokenizer(queryString, "&");
+
+    for(int ii=0; st.hasMoreTokens(); ii++) 
+    {
+      String token = st.nextToken();
+      int p = token.indexOf("=");
+      if (p == -1)
+      {
+        continue;
+      }
+
+      String key = token.substring(0, p);
+      String val = token.substring(p + 1);
+      if (key.startsWith("_chxj_c_")
+      ||  key.startsWith("_chxj_r_")) 
+      {
+        key = key.substring(8);
+        if (key.length() == 0 ||  val.length() == 0)
+        {
+          continue;
+        }
+      }
+      if (ii != 0) 
+      {
+        newQueryString.append("&");
+      }
+      newQueryString.append(key);
+      newQueryString.append("=");
+      try {
+        newQueryString.append(URLDecoder.decode(val, "Windows-31J"));
+      }
+      catch (java.io.UnsupportedEncodingException ee)
+      {
+        throw new RuntimeException(ee);
+      }
+    }
+
+    String resultQueryString = newQueryString.toString();
+    if (resultQueryString.length() == 0)
+    {
+       return null;
+    }
+    return new String(resultQueryString);
+  }
+
+  public String getParameter(String name) 
+  {
+    Map pmap = getParameterMap();
+    if (pmap == null)
+    {
+      return null;
+    }
+
+    String[] vals = (String[])pmap.get(name);
+    if (vals == null)
+    {
+      return null;
+    }
+
+    return vals[0];
+  }
+
+  public Map getParameterMap() 
+  {
+    Map pmap = super.getParameterMap();
+    if (pmap == null)
+    {
+      return null;
+    }
+
+    Map newpmap = new TreeMap();
+
+    if ("get".equalsIgnoreCase(super.getMethod())) 
+    {
+      String queryString = this.getQueryString();
+      if (queryString != null) 
+      {
+        StringTokenizer st = new StringTokenizer(queryString, "&");
+        while (st.hasMoreTokens()) 
+        {
+          String token = st.nextToken();
+          int pos = token.indexOf("=");
+          if (pos == -1)
+          {
+            continue;
+          }
+          String key = token.substring(0, pos);
+          String val = token.substring(pos+1);
+          if (val != null) 
+          {
+            ArrayList list = (ArrayList)newpmap.get(key);
+            if (list == null) 
+            {
+              list = new ArrayList();
+              newpmap.put(key, list);
+            }
+            list.add(val);
+          }
+        }
+      }
+      Iterator it = newpmap.keySet().iterator();
+      while (it.hasNext()) 
+      {
+        String key = (String)it.next();
+        ArrayList list = (ArrayList)newpmap.get(key);
+        String[] newvals = new String[list.size()];
+        for (int ii = 0; ii < list.size(); ii++)
+        {
+          try {
+            newvals[ii] = URLDecoder.decode((String)list.get(ii), "Windows-31J");
+          }
+          catch (java.io.UnsupportedEncodingException ee)
+          {
+            throw new RuntimeException(ee);
+          }
+        }
+        newpmap.put(key, newvals);
+      }
+    }
+    else 
+    {
+      Iterator it = pmap.keySet().iterator();
+      while (it.hasNext()) 
+      {
+        String key = (String)it.next();
+        if (key.startsWith("_chxj_dmy"))
+        {
+          continue;
+        }
+
+        if (key.startsWith("_chxj_c_")
+        ||  key.startsWith("_chxj_r_"))
+        {
+          if (key.substring(8).length() == 0)
+          {
+            continue;
+          }
+          String[] vals = (String[])pmap.get(key);
+          ArrayList list = new ArrayList();
+          for (int ii = 0; ii < vals.length; ii++)
+          {
+            if (vals[ii].length() > 0)
+            {
+              list.add(vals[ii]);
+            }
+          }
+          if (list.size() == 0)
+          {
+            continue;
+          }
+          String[] newvals = new String[list.size()];
+          for (int ii = 0; ii < list.size(); ii++)
+          {
+            try {
+              newvals[ii] = URLDecoder.decode((String)list.get(ii), "Windows-31J");
+            }
+            catch (java.io.UnsupportedEncodingException ee)
+            {
+              throw new RuntimeException(ee);
+            }
+          }
+          newpmap.put(key.substring(8), newvals);
+        }
+        else
+        {
+          String[] vals = (String[])pmap.get(key);
+          ArrayList list = new ArrayList();
+          for (int ii = 0; ii < vals.length; ii++)
+          {
+            if (vals[ii].length() > 0)
+            {
+              list.add(vals[ii]);
+            }
+          }
+          if (list.size() == 0)
+          {
+            continue;
+          }
+          String[] newvals = new String[list.size()];
+          for (int ii = 0; ii < list.size(); ii++)
+          {
+            try {
+              newvals[ii] = URLDecoder.decode((String)list.get(ii), "Windows-31J");
+            }
+            catch (java.io.UnsupportedEncodingException ee)
+            {
+              throw new RuntimeException(ee);
+            }
+          }
+          newpmap.put(key, newvals);
+        }
+      }
+    }
+
+    return newpmap;
+  }
+
+  public Enumeration getParameterNames() 
+  {
+    Map map = getParameterMap();
+    return new ParamNameEnumeration(map);
+  }
+
+  public String[] getParameterValues(String name) 
+  {
+    if (name == null)
+    {
+      throw new NullPointerException();
+    }
+
+    Map pmap = getParameterMap();
+    if (pmap == null)
+    {
+      return null;
+    }
+
+    return (String[])pmap.get(name);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..e29da17
--- /dev/null
@@ -0,0 +1,42 @@
+CLEANFILES = .libs/mod_chxj *~
+
+libmod_chxj_la_SOURCES = mod_chxj.c \
+    qs_parse_string.c \
+    qs_log.c \
+    qs_malloc.c \
+    qs_parse_tag.c \
+    qs_parse_attr.c \
+    qs_ignore_sp.c \
+    qs_parse_file.c \
+    chxj_load_device_data.c \
+    chxj_load_emoji_data.c  \
+    chxj_tag_util.c  \
+    chxj_specified_device.c  \
+    chxj_xhtml_mobile_1_0.c \
+    chxj_hdml.c \
+    chxj_chtml10.c \
+    chxj_chtml20.c \
+    chxj_chtml30.c  \
+    chxj_jhtml.c \
+    chxj_str_util.c  \
+    chxj_img_conv.c  \
+    chxj_dump.c
+
+libmod_chxj_la_CFLAGS = -Wall -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I@with_apache_header@ -I@with_apr_header@
+CFLAGS = -Wall -O2 -prefer-pic @QDEFS@ @DDEFS@ -I. -I@with_apache_header@ -I@with_apr_header@
+
+lib_LTLIBRARIES = libmod_chxj.la
+
+make_so:
+       @if test ! -L mod_chxj.so ; then ln -s .libs/libmod_chxj.so mod_chxj.so ; fi
+
+clean:
+       rm -fr .libs
+       rm -f *.o *.lo *.la
+       rm -f mod_chxj.so
+
+install: make_so
+       @@APXS@ -i -n mod_chxj mod_chxj.so
+
+activate: make_so
+       @@APXS@ -i -a -n mod_chxj mod_chxj.so
diff --git a/src/chxj_chtml10.c b/src/chxj_chtml10.c
new file mode 100644 (file)
index 0000000..1b02206
--- /dev/null
@@ -0,0 +1,1686 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_chtml10.h"
+#include "chxj_hdml.h"
+#include "chxj_dump.h"
+#include "chxj_img_conv.h"
+
+static char* chtml10_node_exchange    (Chtml10* chtml, Node* node, int indent);
+static char* chtml10_start_html_tag   (Chtml10* chtml, Node* child);
+static char* chtml10_end_html_tag     (Chtml10* chtml, Node* child);
+static char* chtml10_start_meta_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_end_meta_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_start_head_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_end_head_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_start_title_tag  (Chtml10* chtml, Node* node);
+static char* chtml10_end_title_tag    (Chtml10* chtml, Node* node);
+static char* chtml10_start_base_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_end_base_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_start_body_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_end_body_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_start_a_tag      (Chtml10* chtml, Node* node);
+static char* chtml10_end_a_tag        (Chtml10* chtml, Node* node);
+static char* chtml10_start_br_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_end_br_tag       (Chtml10* chtml, Node* node);
+static char* chtml10_start_font_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_end_font_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_start_form_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_end_form_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_start_input_tag  (Chtml10* chtml, Node* node);
+static char* chtml10_end_input_tag    (Chtml10* chtml, Node* node);
+static char* chtml10_start_center_tag (Chtml10* chtml, Node* node);
+static char* chtml10_end_center_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_start_hr_tag     (Chtml10* chtml, Node* node);
+static char* chtml10_end_hr_tag       (Chtml10* chtml, Node* node);
+static char* chtml10_start_img_tag    (Chtml10* chtml, Node* node);
+static char* chtml10_end_img_tag      (Chtml10* chtml, Node* node);
+static char* chtml10_start_select_tag (Chtml10* chtml, Node* node);
+static char* chtml10_end_select_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_start_option_tag (Chtml10* chtml, Node* node);
+static char* chtml10_end_option_tag   (Chtml10* chtml, Node* node);
+static char* chtml10_start_div_tag    (Chtml10* chtml, Node* node);
+static char* chtml10_end_div_tag      (Chtml10* chtml, Node* node);
+static void chxj_init_chtml10(Chtml10* chtml, Doc* doc, request_rec* r, device_table* spec);
+static int chtml10_search_emoji(Chtml10* chtml, char* txt, char** rslt);
+static void chtml10_chxjif_tag(Chtml10* chtml, Node* node);
+
+
+/**
+ * converts from CHTML5.0 to CHTML1.0.
+ *
+ * @param r     [i]   Requet_rec is appointed.
+ * @param spec  [i]   The result of the device specification processing which 
+ *                    was done in advance is appointed.
+ * @param src   [i]   The character string before the converting is appointed.
+ * @return The character string after the converting is returned.
+ */
+char*
+chxj_exchange_chtml10(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen)
+{
+  char*     dst = NULL;
+  char*     ss;
+  Chtml10     chtml10;
+  Doc       doc;
+
+  /*--------------------------------------------------------------------------*/
+  /* The CHTML structure is initialized.                                      */
+  /*--------------------------------------------------------------------------*/
+  chxj_init_chtml10(&chtml10, &doc, r, spec);
+
+  /*--------------------------------------------------------------------------*/
+  /* The character string of the input is analyzed.                           */
+  /*--------------------------------------------------------------------------*/
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  ss = apr_pcalloc(r->pool, srclen + 1);
+  memset(ss, 0, srclen + 1);
+  memcpy(ss, src, srclen);
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML -> CHTML1.0", ss, srclen);
+#endif
+
+  qs_parse_string(&doc,ss);
+
+  /*--------------------------------------------------------------------------*/
+  /* It converts it from CHTML to CHTML.                                      */
+  /*--------------------------------------------------------------------------*/
+  dst = chtml10_node_exchange(&chtml10, qs_get_root(&doc), 0);
+  qs_all_free(&doc,QX_LOGMARK);
+
+  if (dst == NULL) 
+  {
+    return apr_pstrdup(r->pool,ss);
+  }
+
+  if (strlen(dst) == 0)
+  {
+    dst = apr_psprintf(r->pool, "\n");
+  }
+  *dstlen = strlen(dst);
+#ifdef DUMP_LOG
+  chxj_dump_out("[dst] CHTML -> CHTML1.0", dst, *dstlen);
+#endif
+  return dst;
+}
+
+/**
+ * The CHTML structure is initialized.
+ *
+ * @param chtml10 [i/o] The pointer to the HDML structure that wants to be
+ *                   initialized is specified.
+ * @param doc   [i]   The Doc structure that should be set to the initialized
+ *                   HDML structure is specified.
+ * @param r     [i]   To use POOL, the pointer to request_rec is specified.
+ * @param spec  [i]   The pointer to the device_table
+ */
+static void
+chxj_init_chtml10(Chtml10* chtml10, Doc* doc, request_rec* r, device_table* spec)
+{
+  memset(doc,   0, sizeof(Doc));
+  memset(chtml10, 0, sizeof(Chtml10));
+
+  doc->r      = r;
+  chtml10->doc  = doc;
+  chtml10->spec = spec;
+  chtml10->out  = qs_alloc_zero_byte_string(r);
+  chtml10->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+}
+
+/**
+ * It is main processing of conversion from CHTML to CHTML. 
+ *
+ * @param chtml10   [i/o] The pointer to the CHTML structure is specified. 
+ * @param node    [i]   The pointer to a current node is specified. 
+ * @param indent  [i]   The depth of the node processing it now is specified. 
+ *
+ * @return The character string after it converts it is returned. 
+ */
+static char*
+chtml10_node_exchange(Chtml10* chtml10, Node* node, int indent) 
+{
+  Node*         child;
+  Doc*          doc   = chtml10->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* It is the main loop of the conversion processing.                        */
+  /*--------------------------------------------------------------------------*/
+  for (child = qs_get_child_node(doc,node);
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <HTML>                                                                 */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "html") == 0) 
+    {
+      chtml10_start_html_tag(chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_html_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <META>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "meta") == 0) 
+    {
+      chtml10_start_meta_tag(chtml10, child);
+      chtml10_end_meta_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HEAD>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "head") == 0) 
+    {
+      chtml10_start_head_tag(chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_head_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <TITLE>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "title") == 0) 
+    {
+      chtml10_start_title_tag (chtml10, child);
+      chtml10_node_exchange   (chtml10, child,indent+1);
+      chtml10_end_title_tag   (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BASE>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "base") == 0) 
+    {
+      chtml10_start_base_tag(chtml10, child);
+      chtml10_end_base_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BODY>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "body") == 0) 
+    {
+      chtml10_start_body_tag(chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_body_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <A>                                                                    */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "a") == 0) 
+    {
+      chtml10_start_a_tag   (chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_a_tag     (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "br") == 0) 
+    {
+      chtml10_start_br_tag  (chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_br_tag    (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FONT>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "font") == 0) 
+    {
+      chtml10_start_font_tag(chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_font_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FORM>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "form") == 0) 
+    {
+      chtml10_start_form_tag(chtml10, child);
+      chtml10_node_exchange (chtml10, child,indent+1);
+      chtml10_end_form_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <INPUT>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "input") == 0) 
+    {
+      chtml10_start_input_tag (chtml10, child);
+      chtml10_node_exchange   (chtml10, child,indent+1);
+      chtml10_end_input_tag   (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "hr") == 0) 
+    {
+      chtml10_start_hr_tag  (chtml10, child);
+      chtml10_end_hr_tag    (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CENTER>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "center") == 0) 
+    {
+      chtml10_start_center_tag(chtml10, child);
+      chtml10_node_exchange   (chtml10, child,indent+1);
+      chtml10_end_center_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <IMG>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "img") == 0) 
+    {
+      chtml10_start_img_tag (chtml10, child);
+      chtml10_end_img_tag   (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <SELECT>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "select") == 0)
+    {
+      chtml10_start_select_tag(chtml10, child);
+      chtml10_node_exchange   (chtml10, child, indent+1);
+      chtml10_end_select_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <OPTION>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "option") == 0)
+    {
+      chtml10_start_option_tag(chtml10, child);
+      chtml10_node_exchange   (chtml10, child, indent+1);
+      chtml10_end_option_tag  (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <DIV>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "div") == 0)
+    {
+      chtml10_start_div_tag (chtml10, child);
+      chtml10_node_exchange (chtml10, child, indent+1);
+      chtml10_end_div_tag   (chtml10, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CHXJ:IF>                                                              */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "chxj:if") == 0)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
+      if (chxj_chxjif_is_mine(chtml10->spec, doc, child))
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
+        chtml10_chxjif_tag(chtml10, child);
+      }
+    }
+    /*------------------------------------------------------------------------*/
+    /* NORMAL TEXT                                                            */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      char*   textval;
+      char*   tmp;
+      char*   tdst;
+      char    one_byte[2];
+      int     ii;
+      int     tdst_len;
+
+      textval = qs_get_node_value(doc,child);
+      textval = qs_trim_string(chtml10->doc->r, textval);
+      if (strlen(textval) == 0)
+      {
+        continue;
+      }
+
+      tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
+      memset(tmp, 0, qs_get_node_size(doc,child)+1);
+
+      tdst     = qs_alloc_zero_byte_string(r);
+      memset(one_byte, 0, sizeof(one_byte));
+      tdst_len = 0;
+
+      for (ii=0; ii<qs_get_node_size(doc,child); ii++)
+      {
+        char* out;
+        int rtn = chtml10_search_emoji(chtml10, &textval[ii], &out);
+        if (rtn != 0)
+        {
+          tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
+          ii+=(rtn - 1);
+          continue;
+        }
+        if (is_sjis_kanji(textval[ii]))
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          one_byte[0] = textval[ii+1];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          ii++;
+        }
+        else if (textval[ii] != '\r' && textval[ii] != '\n')
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+        }
+      }
+      chtml10->out = apr_pstrcat(r->pool, chtml10->out, tdst, NULL);
+    }
+  }
+  return chtml10->out;
+}
+
+/**
+ * Corresponding EMOJI to a current character-code is retrieved. 
+ * The substitution character string is stored in the rslt pointer if agreeing.
+ *
+ * @param chtml10   [i]   The pointer to the CHTML structure is specified. 
+ * @param txt     [i]   The character string to want to examine whether it is 
+ *                      EMOJI is specified. 
+ * @param rslt    [o]   The pointer to the pointer that stores the result is 
+ *                      specified. 
+ * @return When corresponding EMOJI exists, it returns it excluding 0. 
+ */
+static int
+chtml10_search_emoji(Chtml10* chtml10, char* txt, char** rslt)
+{
+  emoji_t*      ee;
+  request_rec*  r;
+  device_table* spec;
+  int           len;
+
+  spec = chtml10->spec;
+
+  len = strlen(txt);
+  r = chtml10->doc->r;
+
+  if (spec == NULL)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
+  }
+
+  for (ee = chtml10->conf->emoji;
+       ee;
+       ee = ee->next) 
+  {
+    if (ee->imode == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "emoji->imode is NULL");
+      continue;
+    }
+
+    if (ee->imode->string != NULL
+    &&  strlen(ee->imode->string) > 0
+    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_palloc(r->pool, 3);
+        (*rslt)[0] = ee->imode->hex1byte & 0xff;
+        (*rslt)[1] = ee->imode->hex2byte & 0xff;
+        (*rslt)[2] = 0;
+        return strlen(ee->imode->string);
+      }
+
+      return 0;
+    }
+  }
+  return 0;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_html_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc*          doc   = chtml10->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* start HTML tag                                                           */
+  /*--------------------------------------------------------------------------*/
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<html>\n", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_html_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</html>\n", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_meta_tag(Chtml10* chtml10, Node* node) 
+{
+  /* ignore */
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_meta_tag(Chtml10* chtml10, Node* child) 
+{
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_head_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<head>\r\n", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_head_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</head>\r\n", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_title_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<title>", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_title_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</title>\r\n", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_base_tag(Chtml10* chtml10, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = chtml10->doc;
+  request_rec*  r     = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<base", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "href") == 0) 
+    {
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+  }
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >\r\n", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_base_tag(Chtml10* chtml10, Node* child) 
+{
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_body_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<body", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+
+    if (strcasecmp(name, "bgcolor") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "link") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "alink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "vlink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\r\n", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_body_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</body>\r\n", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_a_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc*          doc   = chtml10->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<a", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "name") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " name=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "href") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " accesskey=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "cti") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ijam") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "telbook") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "kana") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "email") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ista") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ilet") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "iswf") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "irst") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_a_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</a>", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_br_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<br>\r\n", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_br_tag(Chtml10* chtml10, Node* child) 
+{
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_font_tag(Chtml10* chtml10, Node* node) 
+{
+  /* Ignore */
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_font_tag(Chtml10* chtml10, Node* child) 
+{
+  /* ignore */
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_form_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<form", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "action") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " action=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "method") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " method=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_form_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</form>", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_input_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc*          doc         = chtml10->doc;
+  request_rec*  r           = doc->r;
+  char*         max_length  = NULL;
+  char*         type        = NULL;
+  char*         name        = NULL;
+  char*         value       = NULL;
+  char*         istyle      = NULL;
+  char*         size        = NULL;
+  char*         checked     = NULL;
+  char*         accesskey   = NULL;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<input", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+
+  type       = qs_get_type_attr(doc, node, r);
+  name       = qs_get_name_attr(doc, node, r);
+  value      = qs_get_value_attr(doc,node,r);
+  istyle     = qs_get_istyle_attr(doc,node,r);
+  max_length = qs_get_maxlength_attr(doc,node,r);
+  checked    = qs_get_checked_attr(doc,node,r);
+  accesskey  = qs_get_accesskey_attr(doc, node, r);
+  size       = qs_get_size_attr(doc, node, r);
+
+  if (type != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool,
+                    chtml10->out, 
+                    " type=\"", 
+                    type, 
+                    "\" ", 
+                    NULL);
+  }
+  if (size != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                    chtml10->out, 
+                    " size=\"", 
+                    size, 
+                    "\" ", 
+                    NULL);
+  }
+  if (name != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                    chtml10->out, 
+                    " name=\"", 
+                    name, 
+                    "\" ", 
+                    NULL);
+  }
+  if (value != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                    chtml10->out, 
+                    " value=\"", 
+                    value, 
+                    "\" ", 
+                    NULL);
+  }
+  if (accesskey != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                    chtml10->out, 
+                    " accesskey=\"", 
+                    accesskey, "\" ", 
+                    NULL);
+  }
+  if (istyle != NULL)
+  {
+    /*------------------------------------------------------------------------*/
+    /* CHTML 2.0                                                              */
+    /*------------------------------------------------------------------------*/
+    /* ignore */
+  }
+  /*--------------------------------------------------------------------------*/
+  /* The figure is default for the password.                                  */
+  /*--------------------------------------------------------------------------*/
+  if (max_length != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, 
+                      " maxlength=\"", 
+                      max_length, 
+                      "\"", 
+                      NULL);
+  }
+
+  if (checked != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                    chtml10->out, " checked ", NULL);
+  }
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_input_tag(Chtml10* chtml10, Node* child) 
+{
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_center_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<center>", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_center_tag(Chtml10* chtml10, Node* child) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</center>", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_hr_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<hr ", NULL);
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "align") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool,
+                        chtml10->out, 
+                        " align=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool,
+                        chtml10->out, 
+                        " size=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "width") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool,
+                        chtml10->out, 
+                        " width=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "noshade") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool,
+                        chtml10->out, 
+                        " noshade ", NULL);
+    }
+    else
+    if (strcasecmp(name, "color") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, " >", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_hr_tag(Chtml10* chtml10, Node* child) 
+{
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_img_tag(Chtml10* chtml10, Node* node) 
+{
+  Doc*          doc = chtml10->doc;
+  request_rec*  r   = doc->r;
+  Attr* attr;
+#ifndef IMG_NOT_CONVERT_FILENAME
+  device_table* spec = chtml10->spec;
+#endif
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<img", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "src") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+#ifdef IMG_NOT_CONVERT_FILENAME
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " src=\"",value,"\"", NULL);
+#else
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " src=\"", 
+                      chxj_img_conv(r, spec, value), NULL);
+      chtml10->out = apr_pstrcat(r->pool, chtml10->out, "\"", NULL);
+#endif
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " align=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "width" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " width=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "height") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " height=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "hspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " hspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "vspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " vspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "alt"   ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml10->out = apr_pstrcat(r->pool, 
+                      chtml10->out, " alt=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
+
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_img_tag(Chtml10* chtml10, Node* child) 
+{
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_select_tag(Chtml10* chtml10, Node* child)
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* size      = NULL;
+  char* name      = NULL;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<select", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      size = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "name") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      name = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "multiple") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      /* Ignore */
+    }
+  }
+
+  if (size != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, chtml10->out, " size=\"",size,"\"", NULL);
+  }
+  if (name != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, chtml10->out, " name=\"",name,"\"", NULL);
+  }
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">\n", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_select_tag(Chtml10* chtml10, Node* child)
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</select>\n", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_option_tag(Chtml10* chtml10, Node* child)
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* selected   = NULL;
+  char* value      = NULL;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<option", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "selected") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      selected = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "value") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      value = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (value != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, chtml10->out, " value=\"",value,"\"", NULL);
+  }
+  else
+  {
+    chtml10->out = apr_pstrcat(r->pool, chtml10->out, " value=\"\"", NULL);
+  }
+
+  if (selected != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, chtml10->out, " selected ", NULL);
+  }
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_option_tag(Chtml10* chtml10, Node* child)
+{
+  /* Don't close */
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_start_div_tag(Chtml10* chtml10, Node* child)
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* align   = NULL;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "<div", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "align") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 (W3C version 3.2)                                          */
+      /*----------------------------------------------------------------------*/
+      align = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (align != NULL)
+  {
+    chtml10->out = apr_pstrcat(r->pool, 
+                    chtml10->out, " align=\"", align, "\"", NULL);
+  }
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, ">", NULL);
+  return chtml10->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param chtml10  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml10_end_div_tag(Chtml10* chtml10, Node* child)
+{
+  Doc* doc = chtml10->doc;
+  request_rec* r = doc->r;
+
+  chtml10->out = apr_pstrcat(r->pool, chtml10->out, "</div>\n", NULL);
+
+  return chtml10->out;
+}
+
+static void
+chtml10_chxjif_tag(Chtml10* chtml10, Node* node)
+{
+  Doc*         doc   = chtml10->doc;
+  Node*        child;
+  request_rec* r     = doc->r;
+
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    chtml10->out = apr_pstrcat(r->pool, chtml10->out, child->otext, NULL);
+    chtml10_chxjif_tag(chtml10, child);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_chtml10.h b/src/chxj_chtml10.h
new file mode 100644 (file)
index 0000000..c33a20e
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CHTM_1_0_H__
+#define __CHXJ_CHTM_1_0_H__
+
+/*#define DUMP_CHTML10 "" */
+#include "mod_chxj.h"
+
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _Ctml10_t {
+    Doc* doc;
+    char* out;
+    int   out_len;
+
+    device_table* spec;
+    mod_chxj_config* conf;
+} Chtml10;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char* chxj_exchange_chtml10( request_rec* r, device_table *spec, const char* src, apr_size_t srclen, apr_size_t *dstlen);
+#endif
diff --git a/src/chxj_chtml20.c b/src/chxj_chtml20.c
new file mode 100644 (file)
index 0000000..7d1a8d6
--- /dev/null
@@ -0,0 +1,1807 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_chtml20.h"
+#include "chxj_hdml.h"
+#include "chxj_str_util.h"
+#include "chxj_dump.h"
+#include "chxj_img_conv.h"
+
+static char* chtml20_node_exchange    (Chtml20* chtml, Node* node, int indent);
+static char* chtml20_start_html_tag   (Chtml20* chtml, Node* child);
+static char* chtml20_end_html_tag     (Chtml20* chtml, Node* child);
+static char* chtml20_start_meta_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_end_meta_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_start_head_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_end_head_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_start_title_tag  (Chtml20* chtml, Node* node);
+static char* chtml20_end_title_tag    (Chtml20* chtml, Node* node);
+static char* chtml20_start_base_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_end_base_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_start_body_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_end_body_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_start_a_tag      (Chtml20* chtml, Node* node);
+static char* chtml20_end_a_tag        (Chtml20* chtml, Node* node);
+static char* chtml20_start_br_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_end_br_tag       (Chtml20* chtml, Node* node);
+static char* chtml20_start_font_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_end_font_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_start_form_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_end_form_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_start_input_tag  (Chtml20* chtml, Node* node);
+static char* chtml20_end_input_tag    (Chtml20* chtml, Node* node);
+static char* chtml20_start_center_tag (Chtml20* chtml, Node* node);
+static char* chtml20_end_center_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_start_hr_tag     (Chtml20* chtml, Node* node);
+static char* chtml20_end_hr_tag       (Chtml20* chtml, Node* node);
+static char* chtml20_start_img_tag    (Chtml20* chtml, Node* node);
+static char* chtml20_end_img_tag      (Chtml20* chtml, Node* node);
+static char* chtml20_start_select_tag (Chtml20* chtml, Node* node);
+static char* chtml20_end_select_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_start_option_tag (Chtml20* chtml, Node* node);
+static char* chtml20_end_option_tag   (Chtml20* chtml, Node* node);
+static char* chtml20_start_div_tag    (Chtml20* chtml, Node* node);
+static char* chtml20_end_div_tag      (Chtml20* chtml, Node* node);
+static void chxj_init_chtml20(Chtml20* chtml, Doc* doc, request_rec* r, device_table* spec);
+static int chtml20_search_emoji(Chtml20* chtml, char* txt, char** rslt);
+static void chtml20_chxjif_tag(Chtml20* chtml, Node* node); 
+
+/**
+ * converts from CHTML5.0 to CHTML2.0.
+ *
+ * @param r     [i]   Requet_rec is appointed.
+ * @param spec  [i]   The result of the device specification processing which 
+ *                    was done in advance is appointed.
+ * @param src   [i]   The character string before the converting is appointed.
+ * @return The character string after the converting is returned.
+ */
+char*
+chxj_exchange_chtml20(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen)
+{
+  char*     dst = NULL;
+  char*     ss;
+  Chtml20   chtml20;
+  Doc       doc;
+
+  /*--------------------------------------------------------------------------*/
+  /* The CHTML structure is initialized.                                      */
+  /*--------------------------------------------------------------------------*/
+  chxj_init_chtml20(&chtml20, &doc, r, spec);
+
+  /*--------------------------------------------------------------------------*/
+  /* The character string of the input is analyzed.                           */
+  /*--------------------------------------------------------------------------*/
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  ss = apr_pcalloc(r->pool, srclen + 1);
+  memset(ss, 0, srclen + 1);
+  memcpy(ss, src, srclen);
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML -> CHTML2.0", ss, srclen);
+#endif
+
+  qs_parse_string(&doc,ss);
+
+  /*--------------------------------------------------------------------------*/
+  /* It converts it from CHTML to CHTML.                                      */
+  /*--------------------------------------------------------------------------*/
+  dst = chtml20_node_exchange(&chtml20, qs_get_root(&doc), 0);
+  qs_all_free(&doc,QX_LOGMARK);
+
+  if (dst == NULL) 
+  {
+    return apr_pstrdup(r->pool,ss);
+  }
+
+  if (strlen(dst) == 0)
+  {
+    dst = apr_psprintf(r->pool, "\n");
+  }
+  *dstlen = strlen(dst);
+#ifdef DUMP_LOG
+  chxj_dump_out("[dst] CHTML -> CHTML2.0", dst, *dstlen);
+#endif
+  return dst;
+}
+
+/**
+ * The CHTML structure is initialized.
+ *
+ * @param chtml20 [i/o] The pointer to the HDML structure that wants to be
+ *                   initialized is specified.
+ * @param doc   [i]   The Doc structure that should be set to the initialized
+ *                   HDML structure is specified.
+ * @param r     [i]   To use POOL, the pointer to request_rec is specified.
+ * @param spec  [i]   The pointer to the device_table
+ */
+static void
+chxj_init_chtml20(Chtml20* chtml20, Doc* doc, request_rec* r, device_table* spec)
+{
+  memset(doc,   0, sizeof(Doc));
+  memset(chtml20, 0, sizeof(Chtml20));
+
+  doc->r      = r;
+  chtml20->doc  = doc;
+  chtml20->spec = spec;
+  chtml20->out  = qs_alloc_zero_byte_string(r);
+  chtml20->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+}
+
+/**
+ * It is main processing of conversion from CHTML to CHTML. 
+ *
+ * @param chtml20   [i/o] The pointer to the CHTML structure is specified. 
+ * @param node    [i]   The pointer to a current node is specified. 
+ * @param indent  [i]   The depth of the node processing it now is specified. 
+ *
+ * @return The character string after it converts it is returned. 
+ */
+static char*
+chtml20_node_exchange(Chtml20* chtml20, Node* node, int indent) 
+{
+  Node*         child;
+  Doc*          doc   = chtml20->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* It is the main loop of the conversion processing.                        */
+  /*--------------------------------------------------------------------------*/
+  for (child = qs_get_child_node(doc,node);
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <HTML>                                                                 */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "html") == 0) 
+    {
+      chtml20_start_html_tag(chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_html_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <META>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "meta") == 0) 
+    {
+      chtml20_start_meta_tag(chtml20, child);
+      chtml20_end_meta_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HEAD>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "head") == 0) 
+    {
+      chtml20_start_head_tag(chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_head_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <TITLE>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "title") == 0) 
+    {
+      chtml20_start_title_tag (chtml20, child);
+      chtml20_node_exchange   (chtml20, child,indent+1);
+      chtml20_end_title_tag   (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BASE>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "base") == 0) 
+    {
+      chtml20_start_base_tag(chtml20, child);
+      chtml20_end_base_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BODY>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "body") == 0) 
+    {
+      chtml20_start_body_tag(chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_body_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <A>                                                                    */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "a") == 0) 
+    {
+      chtml20_start_a_tag   (chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_a_tag     (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "br") == 0) 
+    {
+      chtml20_start_br_tag  (chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_br_tag    (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FONT>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "font") == 0) 
+    {
+      chtml20_start_font_tag(chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_font_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FORM>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "form") == 0) 
+    {
+      chtml20_start_form_tag(chtml20, child);
+      chtml20_node_exchange (chtml20, child,indent+1);
+      chtml20_end_form_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <INPUT>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "input") == 0) 
+    {
+      chtml20_start_input_tag (chtml20, child);
+      chtml20_node_exchange   (chtml20, child,indent+1);
+      chtml20_end_input_tag   (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "hr") == 0) 
+    {
+      chtml20_start_hr_tag  (chtml20, child);
+      chtml20_end_hr_tag    (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CENTER>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "center") == 0) 
+    {
+      chtml20_start_center_tag(chtml20, child);
+      chtml20_node_exchange   (chtml20, child,indent+1);
+      chtml20_end_center_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <IMG>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "img") == 0) 
+    {
+      chtml20_start_img_tag (chtml20, child);
+      chtml20_end_img_tag   (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <SELECT>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "select") == 0)
+    {
+      chtml20_start_select_tag(chtml20, child);
+      chtml20_node_exchange   (chtml20, child, indent+1);
+      chtml20_end_select_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <OPTION>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "option") == 0)
+    {
+      chtml20_start_option_tag(chtml20, child);
+      chtml20_node_exchange   (chtml20, child, indent+1);
+      chtml20_end_option_tag  (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <DIV>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "div") == 0)
+    {
+      chtml20_start_div_tag (chtml20, child);
+      chtml20_node_exchange (chtml20, child, indent+1);
+      chtml20_end_div_tag   (chtml20, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BLINK>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "blink") == 0)
+    {
+      /* ignore */
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CHXJ:IF>                                                              */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "chxj:if") == 0)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
+      if (chxj_chxjif_is_mine(chtml20->spec, doc, child))
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
+        chtml20_chxjif_tag(chtml20, child);
+      }
+    }
+    /*------------------------------------------------------------------------*/
+    /* NORMAL TEXT                                                            */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      char*   textval;
+      char*   tmp;
+      char*   tdst;
+      char    one_byte[2];
+      int     ii;
+      int     tdst_len;
+
+      textval = qs_get_node_value(doc,child);
+      textval = qs_trim_string(chtml20->doc->r, textval);
+      if (strlen(textval) == 0)
+      {
+        continue;
+      }
+
+      tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
+      memset(tmp, 0, qs_get_node_size(doc,child)+1);
+
+      tdst     = qs_alloc_zero_byte_string(r);
+      memset(one_byte, 0, sizeof(one_byte));
+      tdst_len = 0;
+
+      for (ii=0; ii<qs_get_node_size(doc,child); ii++)
+      {
+        char* out;
+        int rtn = chtml20_search_emoji(chtml20, &textval[ii], &out);
+        if (rtn != 0)
+        {
+          tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
+          ii+=(rtn - 1);
+          continue;
+        }
+        if (is_sjis_kanji(textval[ii]))
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          one_byte[0] = textval[ii+1];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          ii++;
+        }
+        else if (textval[ii] != '\r' && textval[ii] != '\n')
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+        }
+      }
+      chtml20->out = apr_pstrcat(r->pool, chtml20->out, tdst, NULL);
+    }
+  }
+  return chtml20->out;
+}
+
+/**
+ * Corresponding EMOJI to a current character-code is retrieved. 
+ * The substitution character string is stored in the rslt pointer if agreeing.
+ *
+ * @param chtml20   [i]   The pointer to the CHTML structure is specified. 
+ * @param txt     [i]   The character string to want to examine whether it is 
+ *                      EMOJI is specified. 
+ * @param rslt    [o]   The pointer to the pointer that stores the result is 
+ *                      specified. 
+ * @return When corresponding EMOJI exists, it returns it excluding 0. 
+ */
+static int
+chtml20_search_emoji(Chtml20* chtml20, char* txt, char** rslt)
+{
+  emoji_t*      ee;
+  request_rec*  r;
+  device_table* spec;
+  int           len;
+
+  spec = chtml20->spec;
+
+  len = strlen(txt);
+  r = chtml20->doc->r;
+
+  if (spec == NULL)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
+  }
+
+  for (ee = chtml20->conf->emoji;
+       ee;
+       ee = ee->next) 
+  {
+    if (ee->imode == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "emoji->imode is NULL");
+      continue;
+    }
+
+    if (ee->imode->string != NULL
+    &&  strlen(ee->imode->string) > 0
+    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_palloc(r->pool, 3);
+        (*rslt)[0] = ee->imode->hex1byte & 0xff;
+        (*rslt)[1] = ee->imode->hex2byte & 0xff;
+        (*rslt)[2] = 0;
+        return strlen(ee->imode->string);
+      }
+
+      return 0;
+    }
+  }
+  return 0;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_html_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc   = chtml20->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* start HTML tag                                                           */
+  /*--------------------------------------------------------------------------*/
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<html>\n", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_html_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</html>\n", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_meta_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<meta", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name   = qs_get_attr_name(doc,attr);
+    char* value  = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "http-equiv") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " http-equiv=\"", 
+                      value,
+                      "\"",
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "content") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " content=\"", 
+                      value,
+                      "\"",
+                      NULL);
+    }
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_meta_tag(Chtml20* chtml20, Node* child) 
+{
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_head_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<head>\r\n", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_head_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</head>\r\n", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_title_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<title>", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_title_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</title>\r\n", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_base_tag(Chtml20* chtml20, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = chtml20->doc;
+  request_rec*  r     = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<base", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "href") == 0) 
+    {
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >\r\n", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_base_tag(Chtml20* chtml20, Node* child) 
+{
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_body_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<body", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value  = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "bgcolor") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " bgcolor=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " text=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "link") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " link=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "alink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "vlink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\r\n", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_body_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</body>\r\n", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_a_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc   = chtml20->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<a", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "name") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " name=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "href") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " accesskey=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "cti") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " cti=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "ijam") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "telbook") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "kana") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "email") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ista") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ilet") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "iswf") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "irst") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_a_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</a>", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_br_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<br>\r\n", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_br_tag(Chtml20* chtml20, Node* child) 
+{
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_font_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc   = chtml20->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<font", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "color") == 0) 
+    {
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " color=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_font_tag(Chtml20* chtml20, Node* child) 
+{
+  request_rec* r = chtml20->doc->r;
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</font>", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_form_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<form", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "action") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " action=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "method") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      " method=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_form_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</form>", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_input_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc         = chtml20->doc;
+  request_rec*  r           = doc->r;
+  char*         max_length  = NULL;
+  char*         type        = NULL;
+  char*         name        = NULL;
+  char*         value       = NULL;
+  char*         istyle      = NULL;
+  char*         size        = NULL;
+  char*         checked     = NULL;
+  char*         accesskey   = NULL;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<input", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+
+  type       = qs_get_type_attr(doc, node, r);
+  name       = qs_get_name_attr(doc, node, r);
+  value      = qs_get_value_attr(doc,node,r);
+  istyle     = qs_get_istyle_attr(doc,node,r);
+  max_length = qs_get_maxlength_attr(doc,node,r);
+  checked    = qs_get_checked_attr(doc,node,r);
+  accesskey  = qs_get_accesskey_attr(doc, node, r);
+  size       = qs_get_size_attr(doc, node, r);
+
+  if (type != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool,
+                    chtml20->out, 
+                    " type=\"", 
+                    type, 
+                    "\" ", 
+                    NULL);
+  }
+  if (size != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, 
+                    " size=\"", 
+                    size, 
+                    "\" ", 
+                    NULL);
+  }
+  if (name != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, 
+                    " name=\"", 
+                    name, 
+                    "\" ", 
+                    NULL);
+  }
+  if (value != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, 
+                    " value=\"", 
+                    value, 
+                    "\" ", 
+                    NULL);
+  }
+  if (accesskey != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, 
+                    " accesskey=\"", 
+                    accesskey, "\" ", 
+                    NULL);
+  }
+  if (istyle != NULL)
+  {
+    /*------------------------------------------------------------------------*/
+    /* CHTML 2.0                                                              */
+    /*------------------------------------------------------------------------*/
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, 
+                    " istyle=\"", 
+                    istyle, "\" ", 
+                    NULL);
+  }
+  /*--------------------------------------------------------------------------*/
+  /* The figure is default for the password.                                  */
+  /*--------------------------------------------------------------------------*/
+  if (max_length != NULL)
+  {
+    if (chxj_chk_numeric(max_length) != 0)
+    {
+      max_length = apr_psprintf(r->pool, "0");
+    }
+    if (istyle != NULL && strcasecmp(istyle, "1") == 0)
+    {
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)*2) , NULL);
+    }
+    else
+    {
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, 
+                      apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)) , NULL);
+    }
+  }
+
+  if (checked != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, " checked ", NULL);
+  }
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_input_tag(Chtml20* chtml20, Node* child) 
+{
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_center_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<center>", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_center_tag(Chtml20* chtml20, Node* child) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</center>", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_hr_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<hr ", NULL);
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "align") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool,
+                        chtml20->out, 
+                        " align=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool,
+                        chtml20->out, 
+                        " size=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "width") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool,
+                        chtml20->out, 
+                        " width=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "noshade") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool,
+                        chtml20->out, 
+                        " noshade ", NULL);
+    }
+    else
+    if (strcasecmp(name, "color") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, " >", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_hr_tag(Chtml20* chtml20, Node* child) 
+{
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_img_tag(Chtml20* chtml20, Node* node) 
+{
+  Doc*          doc = chtml20->doc;
+  request_rec*  r   = doc->r;
+  Attr* attr;
+#ifndef IMG_NOT_CONVERT_FILENAME
+  device_table* spec = chtml20->spec;
+#endif
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<img", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "src") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+#ifdef IMG_NOT_CONVERT_FILENAME
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " src=\"",value,"\"", NULL);
+#else
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " src=\"", 
+                      chxj_img_conv(r, spec,value), NULL);
+      chtml20->out = apr_pstrcat(r->pool, chtml20->out, "\"", NULL);
+#endif
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " align=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "width" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " width=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "height") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " height=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "hspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " hspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "vspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " vspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "alt"   ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml20->out = apr_pstrcat(r->pool, 
+                      chtml20->out, " alt=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_img_tag(Chtml20* chtml20, Node* child) 
+{
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_select_tag(Chtml20* chtml20, Node* child)
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* size      = NULL;
+  char* name      = NULL;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<select", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      size = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "name") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      name = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "multiple") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+  }
+
+  if (size != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, chtml20->out, " size=\"",size,"\"", NULL);
+  }
+  if (name != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, chtml20->out, " name=\"",name,"\"", NULL);
+  }
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">\n", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_select_tag(Chtml20* chtml20, Node* child)
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</select>\n", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_option_tag(Chtml20* chtml20, Node* child)
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* selected   = NULL;
+  char* value      = NULL;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<option", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "selected") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      selected = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "value") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      value = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (value != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, chtml20->out, " value=\"",value,"\"", NULL);
+  }
+  else
+  {
+    chtml20->out = apr_pstrcat(r->pool, chtml20->out, " value=\"\"", NULL);
+  }
+
+  if (selected != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, chtml20->out, " selected ", NULL);
+  }
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_option_tag(Chtml20* chtml20, Node* child)
+{
+  /* Don't close */
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_start_div_tag(Chtml20* chtml20, Node* child)
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* align   = NULL;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "<div", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "align") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 (W3C version 3.2)                                          */
+      /*----------------------------------------------------------------------*/
+      align = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (align != NULL)
+  {
+    chtml20->out = apr_pstrcat(r->pool, 
+                    chtml20->out, " align=\"", align, "\"", NULL);
+  }
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, ">", NULL);
+  return chtml20->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param chtml20  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml20_end_div_tag(Chtml20* chtml20, Node* child)
+{
+  Doc* doc = chtml20->doc;
+  request_rec* r = doc->r;
+
+  chtml20->out = apr_pstrcat(r->pool, chtml20->out, "</div>\n", NULL);
+
+  return chtml20->out;
+}
+
+
+static void
+chtml20_chxjif_tag(Chtml20* chtml20, Node* node)
+{
+  Doc*         doc   = chtml20->doc;
+  Node*        child;
+  request_rec* r     = doc->r;
+
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    chtml20->out = apr_pstrcat(r->pool, chtml20->out, child->otext, NULL);
+    chtml20_chxjif_tag(chtml20, child);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_chtml20.h b/src/chxj_chtml20.h
new file mode 100644 (file)
index 0000000..99b4979
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CHTM20_H__
+#define __CHXJ_CHTM20_H__
+
+/*#define DUMP_CHTML20 ""*/
+#include "mod_chxj.h"
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _Ctml20_t {
+    Doc* doc;
+    char* out;
+    int   out_len;
+
+    device_table* spec;
+    mod_chxj_config* conf;
+} Chtml20;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char*
+chxj_exchange_chtml20(
+                  request_rec* r,
+                  device_table *spec,
+                  const char* src,
+                  apr_size_t srclen,
+                  apr_size_t *dstlen);
+#endif
diff --git a/src/chxj_chtml30.c b/src/chxj_chtml30.c
new file mode 100644 (file)
index 0000000..e8c67aa
--- /dev/null
@@ -0,0 +1,1819 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_chtml30.h"
+#include "chxj_hdml.h"
+#include "chxj_str_util.h"
+#include "chxj_dump.h"
+#include "chxj_img_conv.h"
+
+static char* chtml30_node_exchange    (Chtml30* chtml, Node* node, int indent);
+static char* chtml30_start_html_tag   (Chtml30* chtml, Node* child);
+static char* chtml30_end_html_tag     (Chtml30* chtml, Node* child);
+static char* chtml30_start_meta_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_end_meta_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_start_head_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_end_head_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_start_title_tag  (Chtml30* chtml, Node* node);
+static char* chtml30_end_title_tag    (Chtml30* chtml, Node* node);
+static char* chtml30_start_base_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_end_base_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_start_body_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_end_body_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_start_a_tag      (Chtml30* chtml, Node* node);
+static char* chtml30_end_a_tag        (Chtml30* chtml, Node* node);
+static char* chtml30_start_br_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_end_br_tag       (Chtml30* chtml, Node* node);
+static char* chtml30_start_font_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_end_font_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_start_form_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_end_form_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_start_input_tag  (Chtml30* chtml, Node* node);
+static char* chtml30_end_input_tag    (Chtml30* chtml, Node* node);
+static char* chtml30_start_center_tag (Chtml30* chtml, Node* node);
+static char* chtml30_end_center_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_start_hr_tag     (Chtml30* chtml, Node* node);
+static char* chtml30_end_hr_tag       (Chtml30* chtml, Node* node);
+static char* chtml30_start_img_tag    (Chtml30* chtml, Node* node);
+static char* chtml30_end_img_tag      (Chtml30* chtml, Node* node);
+static char* chtml30_start_select_tag (Chtml30* chtml, Node* node);
+static char* chtml30_end_select_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_start_option_tag (Chtml30* chtml, Node* node);
+static char* chtml30_end_option_tag   (Chtml30* chtml, Node* node);
+static char* chtml30_start_div_tag    (Chtml30* chtml, Node* node);
+static char* chtml30_end_div_tag      (Chtml30* chtml, Node* node);
+static void chxj_init_chtml30(Chtml30* chtml, Doc* doc, request_rec* r, device_table* spec);
+static int chtml30_search_emoji(Chtml30* chtml, char* txt, char** rslt);
+static void chtml30_chxjif_tag(Chtml30* chtml, Node* node); 
+
+/**
+ * converts from CHTML5.0 to CHTML3.0.
+ *
+ * @param r     [i]   Requet_rec is appointed.
+ * @param spec  [i]   The result of the device specification processing which 
+ *                    was done in advance is appointed.
+ * @param src   [i]   The character string before the converting is appointed.
+ * @return The character string after the converting is returned.
+ */
+char*
+chxj_exchange_chtml30(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen)
+{
+  char*     dst = NULL;
+  char*     ss;
+  Chtml30   chtml30;
+  Doc       doc;
+
+  /*--------------------------------------------------------------------------*/
+  /* The CHTML structure is initialized.                                      */
+  /*--------------------------------------------------------------------------*/
+  chxj_init_chtml30(&chtml30, &doc, r, spec);
+
+  /*--------------------------------------------------------------------------*/
+  /* The character string of the input is analyzed.                           */
+  /*--------------------------------------------------------------------------*/
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  ss = apr_pcalloc(r->pool, srclen + 1);
+  memset(ss, 0, srclen + 1);
+  memcpy(ss, src, srclen);
+
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML -> CHTML3.0", ss, srclen);
+#endif
+
+  qs_parse_string(&doc,ss);
+
+  /*--------------------------------------------------------------------------*/
+  /* It converts it from CHTML to CHTML.                                      */
+  /*--------------------------------------------------------------------------*/
+  dst = chtml30_node_exchange(&chtml30, qs_get_root(&doc), 0);
+  qs_all_free(&doc,QX_LOGMARK);
+
+  if (dst == NULL) 
+  {
+    return apr_pstrdup(r->pool,ss);
+  }
+
+  if (strlen(dst) == 0)
+  {
+    dst = apr_psprintf(r->pool, "\n");
+  }
+  *dstlen = strlen(dst);
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML -> CHTML3.0", dst, *dstlen);
+#endif
+  return dst;
+}
+
+/**
+ * The CHTML structure is initialized.
+ *
+ * @param chtml30 [i/o] The pointer to the HDML structure that wants to be
+ *                   initialized is specified.
+ * @param doc   [i]   The Doc structure that should be set to the initialized
+ *                   HDML structure is specified.
+ * @param r     [i]   To use POOL, the pointer to request_rec is specified.
+ * @param spec  [i]   The pointer to the device_table
+ */
+static void
+chxj_init_chtml30(Chtml30* chtml30, Doc* doc, request_rec* r, device_table* spec)
+{
+  memset(doc,   0, sizeof(Doc));
+  memset(chtml30, 0, sizeof(Chtml30));
+
+  doc->r      = r;
+  chtml30->doc  = doc;
+  chtml30->spec = spec;
+  chtml30->out  = qs_alloc_zero_byte_string(r);
+  chtml30->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+}
+
+/**
+ * It is main processing of conversion from CHTML to CHTML. 
+ *
+ * @param chtml30   [i/o] The pointer to the CHTML structure is specified. 
+ * @param node    [i]   The pointer to a current node is specified. 
+ * @param indent  [i]   The depth of the node processing it now is specified. 
+ *
+ * @return The character string after it converts it is returned. 
+ */
+static char*
+chtml30_node_exchange(Chtml30* chtml30, Node* node, int indent) 
+{
+  Node*         child;
+  Doc*          doc   = chtml30->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* It is the main loop of the conversion processing.                        */
+  /*--------------------------------------------------------------------------*/
+  for (child = qs_get_child_node(doc,node);
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <HTML>                                                                 */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "html") == 0) 
+    {
+      chtml30_start_html_tag(chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_html_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <META>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "meta") == 0) 
+    {
+      chtml30_start_meta_tag(chtml30, child);
+      chtml30_end_meta_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HEAD>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "head") == 0) 
+    {
+      chtml30_start_head_tag(chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_head_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <TITLE>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "title") == 0) 
+    {
+      chtml30_start_title_tag (chtml30, child);
+      chtml30_node_exchange   (chtml30, child,indent+1);
+      chtml30_end_title_tag   (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BASE>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "base") == 0) 
+    {
+      chtml30_start_base_tag(chtml30, child);
+      chtml30_end_base_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BODY>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "body") == 0) 
+    {
+      chtml30_start_body_tag(chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_body_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <A>                                                                    */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "a") == 0) 
+    {
+      chtml30_start_a_tag   (chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_a_tag     (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "br") == 0) 
+    {
+      chtml30_start_br_tag  (chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_br_tag    (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FONT>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "font") == 0) 
+    {
+      chtml30_start_font_tag(chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_font_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FORM>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "form") == 0) 
+    {
+      chtml30_start_form_tag(chtml30, child);
+      chtml30_node_exchange (chtml30, child,indent+1);
+      chtml30_end_form_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <INPUT>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "input") == 0) 
+    {
+      chtml30_start_input_tag (chtml30, child);
+      chtml30_node_exchange   (chtml30, child,indent+1);
+      chtml30_end_input_tag   (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "hr") == 0) 
+    {
+      chtml30_start_hr_tag  (chtml30, child);
+      chtml30_end_hr_tag    (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CENTER>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "center") == 0) 
+    {
+      chtml30_start_center_tag(chtml30, child);
+      chtml30_node_exchange   (chtml30, child,indent+1);
+      chtml30_end_center_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <IMG>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "img") == 0) 
+    {
+      chtml30_start_img_tag (chtml30, child);
+      chtml30_end_img_tag   (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <SELECT>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "select") == 0)
+    {
+      chtml30_start_select_tag(chtml30, child);
+      chtml30_node_exchange   (chtml30, child, indent+1);
+      chtml30_end_select_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <OPTION>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "option") == 0)
+    {
+      chtml30_start_option_tag(chtml30, child);
+      chtml30_node_exchange   (chtml30, child, indent+1);
+      chtml30_end_option_tag  (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <DIV>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "div") == 0)
+    {
+      chtml30_start_div_tag (chtml30, child);
+      chtml30_node_exchange (chtml30, child, indent+1);
+      chtml30_end_div_tag   (chtml30, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BLINK>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "blink") == 0)
+    {
+      /* ignore */
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CHXJ:IF>                                                              */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "chxj:if") == 0)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
+      if (chxj_chxjif_is_mine(chtml30->spec, doc, child))
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
+        chtml30_chxjif_tag(chtml30, child);
+      }
+    }
+    /*------------------------------------------------------------------------*/
+    /* NORMAL TEXT                                                            */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      char*   textval;
+      char*   tmp;
+      char*   tdst;
+      char    one_byte[2];
+      int     ii;
+      int     tdst_len;
+
+      textval = qs_get_node_value(doc,child);
+      textval = qs_trim_string(chtml30->doc->r, textval);
+      if (strlen(textval) == 0)
+      {
+        continue;
+      }
+
+      tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
+      memset(tmp, 0, qs_get_node_size(doc,child)+1);
+
+      tdst     = qs_alloc_zero_byte_string(r);
+      memset(one_byte, 0, sizeof(one_byte));
+      tdst_len = 0;
+
+      for (ii=0; ii<qs_get_node_size(doc,child); ii++)
+      {
+        char* out;
+        int rtn = chtml30_search_emoji(chtml30, &textval[ii], &out);
+        if (rtn != 0)
+        {
+          tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
+          ii+=(rtn - 1);
+          continue;
+        }
+        if (is_sjis_kanji(textval[ii]))
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          one_byte[0] = textval[ii+1];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          ii++;
+        }
+        else if (textval[ii] != '\r' && textval[ii] != '\n')
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+        }
+      }
+      chtml30->out = apr_pstrcat(r->pool, chtml30->out, tdst, NULL);
+    }
+  }
+  return chtml30->out;
+}
+
+/**
+ * Corresponding EMOJI to a current character-code is retrieved. 
+ * The substitution character string is stored in the rslt pointer if agreeing.
+ *
+ * @param chtml30   [i]   The pointer to the CHTML structure is specified. 
+ * @param txt     [i]   The character string to want to examine whether it is 
+ *                      EMOJI is specified. 
+ * @param rslt    [o]   The pointer to the pointer that stores the result is 
+ *                      specified. 
+ * @return When corresponding EMOJI exists, it returns it excluding 0. 
+ */
+static int
+chtml30_search_emoji(Chtml30* chtml30, char* txt, char** rslt)
+{
+  emoji_t*      ee;
+  request_rec*  r;
+  device_table* spec;
+  int           len;
+
+  spec = chtml30->spec;
+
+  len = strlen(txt);
+  r = chtml30->doc->r;
+
+  if (spec == NULL)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
+  }
+
+  for (ee = chtml30->conf->emoji;
+       ee;
+       ee = ee->next) 
+  {
+    if (ee->imode == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "emoji->imode is NULL");
+      continue;
+    }
+
+    if (ee->imode->string != NULL
+    &&  strlen(ee->imode->string) > 0
+    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_palloc(r->pool, 3);
+        (*rslt)[0] = ee->imode->hex1byte & 0xff;
+        (*rslt)[1] = ee->imode->hex2byte & 0xff;
+        (*rslt)[2] = 0;
+        return strlen(ee->imode->string);
+      }
+
+      return 0;
+    }
+  }
+  return 0;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_html_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc   = chtml30->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* start HTML tag                                                           */
+  /*--------------------------------------------------------------------------*/
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<html>\n", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_html_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</html>\n", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_meta_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<meta", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name   = qs_get_attr_name(doc,attr);
+    char* value  = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "http-equiv") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " http-equiv=\"", 
+                      value,
+                      "\"",
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "content") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " content=\"", 
+                      value,
+                      "\"",
+                      NULL);
+    }
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_meta_tag(Chtml30* chtml30, Node* child) 
+{
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_head_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<head>\r\n", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_head_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</head>\r\n", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_title_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<title>", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_title_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</title>\r\n", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_base_tag(Chtml30* chtml30, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = chtml30->doc;
+  request_rec*  r     = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<base", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "href") == 0) 
+    {
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >\r\n", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_base_tag(Chtml30* chtml30, Node* child) 
+{
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_body_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<body", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value  = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "bgcolor") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " bgcolor=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " text=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "link") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " link=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "alink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "vlink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\r\n", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_body_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</body>\r\n", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_a_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc   = chtml30->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<a", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "name") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " name=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "href") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " accesskey=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "cti") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " cti=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "ijam") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /* It is special only for CHTML.                                        */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " utn ", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "telbook") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+    else
+    if (strcasecmp(name, "kana") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+    else
+    if (strcasecmp(name, "email") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+    else
+    if (strcasecmp(name, "ista") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ilet") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "iswf") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "irst") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_a_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</a>", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_br_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<br>\r\n", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_br_tag(Chtml30* chtml30, Node* child) 
+{
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_font_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc   = chtml30->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<font", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "color") == 0) 
+    {
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " color=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_font_tag(Chtml30* chtml30, Node* child) 
+{
+  request_rec* r = chtml30->doc->r;
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</font>", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_form_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<form", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "action") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " action=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "method") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " method=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /* It is special only for CHTML.                                        */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      " utn ", 
+                      NULL);
+    }
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_form_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</form>", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_input_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc         = chtml30->doc;
+  request_rec*  r           = doc->r;
+  char*         max_length  = NULL;
+  char*         type        = NULL;
+  char*         name        = NULL;
+  char*         value       = NULL;
+  char*         istyle      = NULL;
+  char*         size        = NULL;
+  char*         checked     = NULL;
+  char*         accesskey   = NULL;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<input", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+
+  type       = qs_get_type_attr(doc, node, r);
+  name       = qs_get_name_attr(doc, node, r);
+  value      = qs_get_value_attr(doc,node,r);
+  istyle     = qs_get_istyle_attr(doc,node,r);
+  max_length = qs_get_maxlength_attr(doc,node,r);
+  checked    = qs_get_checked_attr(doc,node,r);
+  accesskey  = qs_get_accesskey_attr(doc, node, r);
+  size       = qs_get_size_attr(doc, node, r);
+
+  if (type != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool,
+                    chtml30->out, 
+                    " type=\"", 
+                    type, 
+                    "\" ", 
+                    NULL);
+  }
+  if (size != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, 
+                    " size=\"", 
+                    size, 
+                    "\" ", 
+                    NULL);
+  }
+  if (name != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, 
+                    " name=\"", 
+                    name, 
+                    "\" ", 
+                    NULL);
+  }
+  if (value != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, 
+                    " value=\"", 
+                    value, 
+                    "\" ", 
+                    NULL);
+  }
+  if (accesskey != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, 
+                    " accesskey=\"", 
+                    accesskey, "\" ", 
+                    NULL);
+  }
+  if (istyle != NULL)
+  {
+    /*------------------------------------------------------------------------*/
+    /* CHTML 2.0                                                              */
+    /*------------------------------------------------------------------------*/
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, 
+                    " istyle=\"", 
+                    istyle, "\" ", 
+                    NULL);
+  }
+  /*--------------------------------------------------------------------------*/
+  /* The figure is default for the password.                                  */
+  /*--------------------------------------------------------------------------*/
+  if (max_length != NULL)
+  {
+    if (chxj_chk_numeric(max_length) != 0)
+    {
+      max_length = apr_psprintf(r->pool, "0");
+    }
+
+    if (istyle != NULL && strcasecmp(istyle, "1") == 0)
+    {
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length) * 2), 
+                      NULL);
+    }
+    else 
+    {
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, 
+                      apr_psprintf(r->pool, " maxlength=\"%d\"", chxj_atoi(max_length)), 
+                      NULL);
+    }
+  }
+
+  if (checked != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, " checked ", NULL);
+  }
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_input_tag(Chtml30* chtml30, Node* child) 
+{
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_center_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<center>", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_center_tag(Chtml30* chtml30, Node* child) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</center>", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_hr_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<hr ", NULL);
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "align") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool,
+                        chtml30->out, 
+                        " align=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool,
+                        chtml30->out, 
+                        " size=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "width") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool,
+                        chtml30->out, 
+                        " width=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "noshade") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool,
+                        chtml30->out, 
+                        " noshade ", NULL);
+    }
+    else
+    if (strcasecmp(name, "color") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, " >", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_hr_tag(Chtml30* chtml30, Node* child) 
+{
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_img_tag(Chtml30* chtml30, Node* node) 
+{
+  Doc*          doc = chtml30->doc;
+  request_rec*  r   = doc->r;
+  Attr* attr;
+#ifndef IMG_NOT_CONVERT_FILENAME
+  device_table* spec = chtml30->spec;
+#endif
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<img", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "src") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+#ifdef IMG_NOT_CONVERT_FILENAME
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " src=\"",value,"\"", NULL);
+#else
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " src=\"", 
+                      chxj_img_conv(r,spec,value), NULL);
+      chtml30->out = apr_pstrcat(r->pool, chtml30->out, "\"", NULL);
+#endif
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " align=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "width" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " width=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "height") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " height=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "hspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " hspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "vspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " vspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "alt"   ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      chtml30->out = apr_pstrcat(r->pool, 
+                      chtml30->out, " alt=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_img_tag(Chtml30* chtml30, Node* child) 
+{
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_select_tag(Chtml30* chtml30, Node* child)
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* size      = NULL;
+  char* name      = NULL;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<select", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      size = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "name") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      name = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "multiple") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+  }
+
+  if (size != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, chtml30->out, " size=\"",size,"\"", NULL);
+  }
+  if (name != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, chtml30->out, " name=\"",name,"\"", NULL);
+  }
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">\n", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_select_tag(Chtml30* chtml30, Node* child)
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</select>\n", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_option_tag(Chtml30* chtml30, Node* child)
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* selected   = NULL;
+  char* value      = NULL;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<option", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "selected") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      selected = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "value") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      value = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (value != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"",value,"\"", NULL);
+  }
+  else
+  {
+    chtml30->out = apr_pstrcat(r->pool, chtml30->out, " value=\"\"", NULL);
+  }
+
+  if (selected != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, chtml30->out, " selected ", NULL);
+  }
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_option_tag(Chtml30* chtml30, Node* child)
+{
+  /* Don't close */
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_start_div_tag(Chtml30* chtml30, Node* child)
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* align   = NULL;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "<div", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "align") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 (W3C version 3.2)                                          */
+      /*----------------------------------------------------------------------*/
+      align = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (align != NULL)
+  {
+    chtml30->out = apr_pstrcat(r->pool, 
+                    chtml30->out, " align=\"", align, "\"", NULL);
+  }
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, ">", NULL);
+  return chtml30->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param chtml30  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+chtml30_end_div_tag(Chtml30* chtml30, Node* child)
+{
+  Doc* doc = chtml30->doc;
+  request_rec* r = doc->r;
+
+  chtml30->out = apr_pstrcat(r->pool, chtml30->out, "</div>\n", NULL);
+
+  return chtml30->out;
+}
+
+
+static void
+chtml30_chxjif_tag(Chtml30* chtml30, Node* node)
+{
+  Doc*         doc   = chtml30->doc;
+  Node*        child;
+  request_rec* r     = doc->r;
+
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    chtml30->out = apr_pstrcat(r->pool, chtml30->out, child->otext, NULL);
+    chtml30_chxjif_tag(chtml30, child);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_chtml30.h b/src/chxj_chtml30.h
new file mode 100644 (file)
index 0000000..9f15f95
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_CHTM30_H__
+#define __CHXJ_CHTM30_H__
+
+/* #define DUMP_CHTML30 "" */
+#include "mod_chxj.h"
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _Ctml30_t {
+    Doc* doc;
+    char* out;
+    int   out_len;
+
+    device_table* spec;
+    mod_chxj_config* conf;
+} Chtml30;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char*
+chxj_exchange_chtml30(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen);
+#endif
diff --git a/src/chxj_dump.c b/src/chxj_dump.c
new file mode 100644 (file)
index 0000000..0cc40ef
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+
+void
+chxj_dump_out(const char* title, const char* s, int slen)
+{
+#ifdef DUMP_LOG
+  FILE* fp=fopen(DUMP_LOG, "a");
+  if (fp != NULL) 
+  {
+    fprintf(fp, "%s\n", title);
+    fprintf(fp, "[%.*s]\n", slen, s);
+    fprintf(fp, "-----------------------------\n");
+    fclose(fp);
+  }
+#endif
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_dump.h b/src/chxj_dump.h
new file mode 100644 (file)
index 0000000..b5b8d9d
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_DUMP_H__
+#define __CHXJ_DUMP_H__
+void chxj_dump_out(const char* title, const char* s, int slen);
+#endif
diff --git a/src/chxj_hdml.c b/src/chxj_hdml.c
new file mode 100644 (file)
index 0000000..fc6b861
--- /dev/null
@@ -0,0 +1,2753 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_hdml.h"
+#include "chxj_tag_util.h"
+#include "chxj_str_util.h"
+#include <unistd.h>
+#include "chxj_img_conv.h"
+#include "chxj_dump.h"
+#define CHECK_BOX_PREFIX "_chxj_c_"
+#define RADIO_BUTTON_PREFIX "_chxj_r_"
+
+static void chxj_init_hdml(Hdml* hdml, Doc* doc, request_rec* r, device_table* spec);
+static char* hdml_1_0_node_exchange   (Hdml* doc, Node* node, int indent);
+static char* hdml_1_0_start_html_tag  (Hdml* doc, Node* child) ;
+static char* hdml_1_0_end_html_tag    (Hdml* doc, Node* child) ;
+static char* hdml_1_0_start_meta_tag  (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_meta_tag    (Hdml* doc, Node* node) ;
+static char* hdml_1_0_start_head_tag  (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_head_tag    (Hdml* doc, Node* node) ;
+static char* hdml_1_0_start_title_tag (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_title_tag   (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_base_tag  (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_base_tag    (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_body_tag  (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_body_tag    (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_a_tag     (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_a_tag       (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_br_tag    (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_br_tag      (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_font_tag  (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_font_tag    (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_form_tag  (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_form_tag    (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_input_tag (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_input_tag   (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_select_tag(Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_select_tag  (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_option_tag(Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_option_tag  (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_center_tag(Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_center_tag  (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_hr_tag    (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_hr_tag      (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_img_tag   (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_img_tag     (Hdml* doc,  Node* node) ;
+static char* hdml_1_0_start_div_tag   (Hdml* doc, Node* node) ;
+static char* hdml_1_0_end_div_tag     (Hdml* doc,  Node* node) ;
+static char* qs_get_form_no(request_rec* r, Hdml* hdml);
+static void hdml_1_0_count_radio_tag  (Hdml* hdml, Node* node) ;
+static void hdml_do_input_text_tag    (Hdml* hdml, Node* tag);
+static void hdml_do_input_password_tag(Hdml* hdml, Node* tag);
+static void hdml_do_input_submit_tag  (Hdml* hdml, Node* tag);
+static void hdml_do_input_hidden_tag  (Hdml* hdml, Node* tag);
+static void hdml_do_input_radio_tag   (Hdml* hdml, Node* tag);
+static void hdml_do_input_checkbox_tag(Hdml* hdml, Node* tag);
+static void hdml_tag_output_upper_half(Hdml* hdml, Node* node);
+static Hdml* qs_output_to_hdml_out    (Hdml* hdml, char* s);
+static Hdml* qs_output_to_hdml_card   (Hdml* hdml, char* s);
+static void qs_output_to_postdata     (Hdml* hdml, char* s);
+static void qs_output_to_init_vars    (Hdml* hdml, char* s);
+static int hdml_search_emoji          (Hdml* hdml, char* txt, char** rslt);
+static void hdml_1_0_chxjif_tag       (Hdml* hdml, Node* node);
+/**
+ * converts from CHTML to hdml.
+ *
+ * @param r    [i] Requet_rec is appointed.
+ * @param spec [i] The result of the device specification processing which 
+ *                 was done in advance is appointed.
+ * @param src  [i] The character string before the converting is appointed.
+ * @return         The character string after the converting is returned.
+ */
+char*
+chxj_exchange_hdml(request_rec* r, 
+                   device_table *spec, 
+                   const char* src, 
+                   apr_size_t srclen, 
+                   apr_size_t* dstlen)
+{
+  char*     dst = NULL;
+  char*     buf = NULL;
+  Doc       doc;
+  Hdml      hdml;
+  void*     shm_segment;
+  int*      shm;
+  mod_chxj_global_config* gconf;
+
+  /*--------------------------------------------------------------------------*/
+  /* initialize hdml structure                                                */
+  /*--------------------------------------------------------------------------*/
+  chxj_init_hdml(&hdml,&doc,r, spec);
+
+  /*--------------------------------------------------------------------------*/
+  /* DEBUG                                                                    */
+  /*--------------------------------------------------------------------------*/
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML->HDML", src, srclen);
+#endif
+
+
+  /*--------------------------------------------------------------------------*/
+  /* It is examined whether there is a location header. It ends without doing */
+  /* anything when is.                                                        */
+  /*--------------------------------------------------------------------------*/
+  buf = (char*)apr_table_get(r->headers_out, (const char*)"Location");
+  if (buf != NULL) 
+  {
+    /*------------------------------------------------------------------------*/
+    /* The Location header generates tag in an initial HDML machine for the   */
+    /* uncorrespon dence.                                                     */
+    /*------------------------------------------------------------------------*/
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                    "Location is not null[Location:%s]", buf);
+    qs_output_to_hdml_out(&hdml, 
+        "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\n"
+        "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\n"
+        "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
+        );
+    qs_output_to_hdml_out(&hdml, buf);
+    qs_output_to_hdml_out(&hdml,
+        "\">\n"
+        "</NODISPLAY>\n"
+        "</HDML>\n"
+        );
+    dst = apr_pstrdup(r->pool, hdml.out);
+  }
+  else 
+  {
+    /*------------------------------------------------------------------------*/
+    /* Here, the parsing of the received character string is done             */
+    /*------------------------------------------------------------------------*/
+    char *ss = apr_pstrdup(r->pool, src);
+    qs_init_malloc(&doc); 
+    qs_init_root_node(&doc);
+    ss[srclen] = '\0';
+    qs_parse_string(&doc,ss);
+
+    /*------------------------------------------------------------------------*/
+    /* The number of radiobuttons is counted.                                 */
+    /*------------------------------------------------------------------------*/
+    hdml_1_0_count_radio_tag(&hdml, qs_get_root(&doc));
+
+    dst = hdml_1_0_node_exchange(&hdml, qs_get_root(&doc), 0);
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "tmp=[%s]", dst);
+    qs_all_free(&doc,QX_LOGMARK);
+  }
+
+  /*--------------------------------------------------------------------------*/
+  /* DEBUG                                                                    */
+  /*--------------------------------------------------------------------------*/
+#ifdef DUMP_LOG
+  chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
+#endif
+
+  /*--------------------------------------------------------------------------*/
+  /* When there is no processing result, former character string is copied    */
+  /* and it returns it.                                                       */
+  /*--------------------------------------------------------------------------*/
+  if (dst == NULL) 
+  {
+    *dstlen = srclen;
+    return apr_pstrdup(r->pool,src);
+  }
+
+  *dstlen = hdml.out_len;
+
+  /*--------------------------------------------------------------------------*/
+  /* for HDML Counter                                                         */
+  /*--------------------------------------------------------------------------*/
+  gconf = ap_get_module_config(r->server->module_config, &chxj_module);
+
+  apr_global_mutex_lock(gconf->client_lock);
+  shm_segment = apr_shm_baseaddr_get(gconf->client_shm);
+  shm = (int*)shm_segment;
+  hdml.form_cnt = *shm;
+  *shm = hdml.form_cnt + hdml.pure_form_cnt + 1;
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                  "form_cnt[%d] -> [%d]", hdml.form_cnt,
+                                          *shm);
+  apr_global_mutex_unlock(gconf->client_lock); 
+
+  /*--------------------------------------------------------------------------*/
+  /* Null is set at the end of the character string to make sure.             */
+  /*--------------------------------------------------------------------------*/
+  dst[hdml.out_len] = 0;
+  return dst;
+}
+
+/**
+ * The HDML structure is initialized. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure that wants to be 
+ *                   initialized is specified. 
+ * @param doc  [i]   The Doc structure that should be set to the initialized 
+ *                   HDML structure is specified. 
+ * @param r    [i]   To use POOL, the pointer to request_rec is specified. 
+ * @param spec [i]   The pointer to the device_table
+ */
+static void 
+chxj_init_hdml(Hdml* hdml, Doc* doc, request_rec* r, device_table* spec)
+{
+  int     ii;
+  int     jj;
+  void*   shm_segment;
+  int*    shm;
+  mod_chxj_global_config* gconf;
+
+  /*--------------------------------------------------------------------------*/
+  /* init hdml structure value                                                */
+  /*--------------------------------------------------------------------------*/
+  memset(hdml, 0, sizeof(Hdml));
+  hdml->doc      = doc;
+  hdml->card     = qs_alloc_zero_byte_string(r);
+  hdml->spec     = spec;
+  hdml->conf     = ap_get_module_config(r->per_dir_config, &chxj_module);
+
+  for (ii=0; ii<MAX_FORM_COUNT; ii++) 
+  {
+    hdml->var_cnt[ii]     = 0;
+    hdml->postdata[ii]    = qs_alloc_zero_byte_string(r);
+  }
+
+  for (ii=0; ii<MAX_RADIO_COUNT; ii++) 
+  {
+    for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) 
+    {
+      hdml->radio_value_list[ii][jj] = NULL;
+    }
+    hdml->radio_name_list[ii] = NULL;
+    hdml->radio_out_cnt[ii] = 0;
+    hdml->radio_checked_value[ii] = NULL;
+  }
+  hdml->init_vars      = qs_alloc_zero_byte_string(r);
+
+  doc->r               = r;
+
+  /*--------------------------------------------------------------------------*/
+  /* for HDML Counter                                                         */
+  /*--------------------------------------------------------------------------*/
+  gconf = ap_get_module_config(r->server->module_config, &chxj_module);
+  apr_global_mutex_lock(gconf->client_lock);
+  shm_segment = apr_shm_baseaddr_get(gconf->client_shm);
+  shm = (int*)shm_segment;
+  hdml->form_cnt = *shm;
+  apr_global_mutex_unlock(gconf->client_lock); 
+
+  hdml->out = qs_alloc_zero_byte_string(r);
+}
+
+/**
+ * It is main processing converted from CHTML to HDML. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The route node is specified. 
+ * @param indent [i]   Depth from the route node is specified. At present, 
+ *                     other use doesn't exist. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_node_exchange(Hdml* hdml, Node* node,  int indent) 
+{
+  Node*         child;
+  Doc*          doc   = hdml->doc; 
+  request_rec*  r     = doc->r;
+
+  for (child = qs_get_child_node(doc,node); child != NULL; child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*----------------------------------------------------------------------*/
+    /* When </ HDML > tag has already been output, it doesn't process it.   */
+    /*----------------------------------------------------------------------*/
+    if (hdml->hdml_end_flag == 1) 
+    {
+      continue;
+    }
+
+    /*------------------------------------------------------------------------*/
+    /* <HTML>                                                                 */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "html") == 0) 
+    {
+      hdml->out = hdml_1_0_start_html_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_html_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <META>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "meta") == 0) 
+    {
+      hdml->out = hdml_1_0_start_meta_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_end_meta_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HEAD>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "head") == 0) 
+    {
+      hdml->out = hdml_1_0_start_head_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_head_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <TITLE>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "title") == 0) 
+    {
+      hdml->out = hdml_1_0_start_title_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_title_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BASE>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "base") == 0) 
+    {
+      hdml->out = hdml_1_0_start_base_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_end_base_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BODY>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "body") == 0) 
+    {
+      hdml->out = hdml_1_0_start_body_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_body_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <A>                                                                    */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "a") == 0) 
+    {
+      hdml->out = hdml_1_0_start_a_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_a_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "br") == 0) 
+    {
+      hdml->out = hdml_1_0_start_br_tag(hdml, child);
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_br_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FONT>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "font") == 0) 
+    {
+      hdml->out = hdml_1_0_start_font_tag(hdml, child);
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_font_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FORM>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "form") == 0) 
+    {
+      hdml->out = hdml_1_0_start_form_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_form_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <INPUT>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "input") == 0) 
+    {
+      hdml->out = hdml_1_0_start_input_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_input_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <SELECT>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "select") == 0) 
+    {
+      hdml->out = hdml_1_0_start_select_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_select_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <OPTION>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "option") == 0) 
+    {
+      hdml->out = hdml_1_0_start_option_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_option_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <DIV>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "div") == 0) 
+    {
+      hdml->out = hdml_1_0_start_div_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_node_exchange(hdml, child, indent+1);
+      hdml->out = hdml_1_0_end_div_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "hr") == 0) 
+    {
+      hdml->out = hdml_1_0_start_hr_tag(hdml, child);
+      hdml->out = hdml_1_0_end_hr_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CENTER>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "center") == 0) 
+    {
+      hdml->out = hdml_1_0_start_center_tag(hdml, child);
+      hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
+      hdml->out = hdml_1_0_end_center_tag(hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <IMG>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "img") == 0) 
+    {
+      hdml->out = hdml_1_0_start_img_tag(hdml, child);
+      hdml->hdml_br_flag = 0;
+      hdml->out = hdml_1_0_end_img_tag  (hdml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CHXJ:IF>                                                              */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "chxj:if") == 0) 
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
+      if (chxj_chxjif_is_mine(hdml->spec, doc, child))
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
+        hdml_1_0_chxjif_tag(hdml, child);
+      }
+    }
+    /*------------------------------------------------------------------------*/
+    /* NORMAL TEXT                                                            */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      char* textval;
+      char* tmp;
+      char* tdst;
+      char one_byte[2];
+      int ii;
+      int tdst_len = 0;
+
+      textval = qs_get_node_value(doc,child);
+      textval = qs_trim_string(r, textval);
+      if (strlen(textval) == 0)
+      {
+        continue;
+      }
+
+      if (hdml->option_flag == 1) 
+      {
+        continue;
+      }
+
+      tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
+      memset(tmp, 0, qs_get_node_size(doc,child)+1);
+      tdst = apr_palloc(r->pool, 1);
+      tdst[0] = '\0';
+      one_byte[0] = '\0';
+      one_byte[1] = '\0';
+
+      for (ii=0; ii<qs_get_node_size(doc,child); ii++) 
+      {
+        char* out;
+        int rtn = hdml_search_emoji(hdml, &textval[ii], &out);
+        if (rtn != 0)
+        {
+          tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
+          ii += (rtn-1);
+          continue;
+        }
+        if (is_sjis_kanji(textval[ii])) 
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          one_byte[0] = textval[ii+1];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          ii++;
+        }
+        else if (textval[ii] != '\r' && textval[ii] != '\n') 
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+        }
+      }
+      memcpy(tmp, textval, strlen(textval)-1);
+
+      hdml_tag_output_upper_half(hdml, node);
+      qs_output_to_hdml_out(hdml, tdst);
+      hdml->hdml_br_flag = 0;
+    }
+  }
+  hdml->out[hdml->out_len] = 0;
+  return hdml->out;
+}
+
+static int
+hdml_search_emoji(Hdml* hdml, char* txt, char** rslt)
+{
+  emoji_t* ee;
+  request_rec* r;
+  device_table* spec;
+  int len;
+
+  spec = hdml->spec;
+
+  len = strlen(txt);
+  r = hdml->doc->r;
+
+  if (spec == NULL)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
+  }
+
+  for (ee = hdml->conf->emoji;
+       ee;
+       ee = ee->next) 
+  {
+    unsigned char hex1byte;
+    unsigned char hex2byte;
+    if (ee->imode == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "emoji->imode is NULL");
+      continue;
+    }
+    hex1byte = ee->imode->hex1byte & 0xff;
+    hex2byte = ee->imode->hex2byte & 0xff;
+
+    if (ee->imode->string != NULL
+    &&  strlen(ee->imode->string) > 0
+    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeA);
+        return strlen(ee->imode->string);
+      }
+
+      if (strcasecmp(hdml->spec->emoji_type, "a") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeA);
+        return strlen(ee->imode->string);
+      } 
+      else
+      if (strcasecmp(hdml->spec->emoji_type, "b") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeB);
+        return strlen(ee->imode->string);
+      }
+      else
+      if (strcasecmp(hdml->spec->emoji_type, "c") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeC);
+        return strlen(ee->imode->string);
+      }
+      else
+      if (strcasecmp(hdml->spec->emoji_type, "d") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeD);
+        return strlen(ee->imode->string);
+      }
+      else
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeA);
+        return strlen(ee->imode->string);
+      }
+      return 0;
+    }
+    if (len >= 2
+    && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
+    && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) 
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeA);
+        return 2;
+      }
+
+      if (strcasecmp(hdml->spec->emoji_type, "a") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeA);
+        return 2;
+      } 
+      else
+      if (strcasecmp(hdml->spec->emoji_type, "b") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeB);
+        return 2;
+      }
+      else
+      if (strcasecmp(hdml->spec->emoji_type, "c") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeC);
+        return 2;
+      }
+      else
+      if (strcasecmp(hdml->spec->emoji_type, "d") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeD);
+        return 2;
+      }
+      else
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<IMG ICON=%s>",
+                        ee->ezweb->typeA);
+        return 2;
+      }
+      return 0;
+    }
+  }
+  return 0;
+}
+/**
+ * It is a handler who processes the HTML tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_html_tag(Hdml* hdml, Node* node) 
+{
+  qs_output_to_hdml_out(hdml, 
+    "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\n"
+    "<NODISPLAY NAME=D0>\n"
+    "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\n"
+    "</NODISPLAY>\n"
+    );
+
+  hdml->card_cnt = 2;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the HTML tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_html_tag(Hdml* hdml, Node* child) 
+{
+  qs_output_to_hdml_card(hdml, 
+                  "<NODISPLAY NAME=D1>\n"
+                  "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
+                  );
+
+  if (strlen(hdml->init_vars) != 0) 
+  {
+    qs_output_to_hdml_card(hdml, hdml->init_vars   );
+  }
+  else 
+  {
+    qs_output_to_hdml_card(hdml, "_chxj_dmy="            );
+  }
+
+  qs_output_to_hdml_card(hdml,   
+                  "\" CLEAR=TRUE>\n"
+                  "</NODISPLAY>\n"
+                  );
+
+  qs_output_to_hdml_out(hdml, hdml->card );
+  qs_output_to_hdml_out(hdml, "</HDML>\n");
+
+  hdml->hdml_end_flag = 1;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the META tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_meta_tag(Hdml* hdml, Node* node) 
+{
+  /* ignore */
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the META tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_meta_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_head_tag(Hdml* hdml, Node* node) 
+{
+  /* ignore */
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_head_tag(Hdml* hdml, Node* child) 
+{
+  /* ignore */
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_title_tag(Hdml* hdml, Node* node) 
+{
+  qs_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
+  hdml->found_title = 1;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_title_tag(Hdml* hdml, Node* child) 
+{
+  qs_output_to_hdml_out(hdml, "\">\n");
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_base_tag(Hdml* hdml, Node* node) 
+{
+  return hdml->out;
+}
+
+
+/**
+ * It is a handler who processes the BASE tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_base_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_body_tag(Hdml* hdml, Node* node) 
+{
+  Doc*         doc  = hdml->doc;
+  Attr*        attr;
+
+  if (hdml->found_title == 0)
+  {
+    qs_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\n");
+  }
+  qs_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
+
+  /*--------------------------------*/
+  /* Get Attributes                 */
+  /*--------------------------------*/
+  for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    if (strcasecmp(name, "bgcolor")     == 0) 
+    {
+      /* ignore */
+    }
+    else if (strcasecmp(name, "text")   == 0) 
+    {
+      /* ignore */
+    }
+    else if (strcasecmp(name, "link")   == 0) 
+    {
+      /* ignore */
+    }
+    else if (strcasecmp(name, "alink")  == 0) 
+    {
+      /* ignore */
+    }
+    else if (strcasecmp(name, "vlink")  == 0) 
+    {
+      /* ignore */
+    }
+  }
+
+  qs_output_to_hdml_out(hdml, ">\n");
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_body_tag(Hdml* hdml, Node* child) 
+{
+  qs_output_to_hdml_out(hdml, "\n</DISPLAY>\n");
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the A tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_a_tag(Hdml* hdml, Node* node) 
+{
+  Doc*         doc  = hdml->doc;
+  Attr*        attr;
+
+  hdml_tag_output_upper_half(hdml,node);
+
+  qs_output_to_hdml_out(hdml, "<A");
+
+
+  /*------------------------------------*/
+  /* Get Attributes                     */
+  /*------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "name") == 0) 
+    {
+      /* IGNORE */
+    }
+    else if (strcasecmp(name, "href") == 0) 
+    {
+      if (strncasecmp(value, "mailto:", 7) == 0) 
+      {
+        qs_output_to_hdml_out(hdml, " TASK=GO DEST=\""     );
+        qs_output_to_hdml_out(hdml, value                  );
+        qs_output_to_hdml_out(hdml, "\" "                  );
+      }
+      else 
+      if (strncasecmp(value, "tel:", 4) == 0) 
+      {
+
+        qs_output_to_hdml_out(hdml,  " TASK=CALL NUMBER=\"");
+        qs_output_to_hdml_out(hdml, &value[4]              );
+        qs_output_to_hdml_out(hdml, "\" "                  );
+      }
+      else 
+      {
+        qs_output_to_hdml_out(hdml, " TASK=GO DEST=\""     );
+        qs_output_to_hdml_out(hdml, value                  );
+        qs_output_to_hdml_out(hdml, "\""                   );
+      }
+    }
+    else
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      if (strcasecmp(value, "0") != 0) {
+        qs_output_to_hdml_out(hdml, " ACCESSKEY="          );
+        qs_output_to_hdml_out(hdml, value                  );
+        qs_output_to_hdml_out(hdml, ""                     );
+      }
+    }
+    else
+    if (strcasecmp(name, "cti") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ijam") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "telbook") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "kana") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "email") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ista") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ilet") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "iswf") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "irst") == 0) 
+    {
+      /* ignore */
+    }
+  }
+  qs_output_to_hdml_out(hdml, ">"  );
+
+  hdml->hdml_a_flag = 1;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the A tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_a_tag(Hdml* hdml, Node* child) 
+{
+  qs_output_to_hdml_out(hdml, "</A>\n");
+
+  hdml->hdml_a_flag = 0;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the BR tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_br_tag(Hdml* hdml, Node* node) 
+{
+  if (hdml->in_center > 0) 
+  {
+    hdml->in_center = 0;
+  }
+  if (hdml->div_in_center > 0) 
+  {
+    hdml->div_in_center = 0;
+  }
+
+  qs_output_to_hdml_out(hdml, "<BR>\n");
+
+  hdml->hdml_br_flag = 1;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the BR tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_br_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_font_tag(Hdml* hdml, Node* node) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_end_font_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag. 
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified. 
+ * @return The conversion result is returned. 
+ */
+static char*
+hdml_1_0_start_form_tag(Hdml* hdml, Node* node) 
+{
+  request_rec* r = hdml->doc->r;
+  Attr* attr;
+  Doc* doc = hdml->doc;
+  char* act = NULL;
+
+  hdml->form_tmp = apr_psprintf(r->pool,
+                  "<NODISPLAY NAME=F%d>\n",
+                  hdml->pure_form_cnt);
+  hdml->form_tmp = apr_pstrcat(r->pool,
+                           hdml->form_tmp,
+                           "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",NULL);
+  /* Get Attributes */
+  for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "action") == 0) 
+    {
+      act = apr_psprintf(r->pool, "%s", value);
+      break;
+    }
+  }
+  if (act != NULL) 
+  {
+    hdml->form_tmp = apr_pstrcat(r->pool,
+                             hdml->form_tmp,
+                             act,
+                             NULL);
+  }
+  hdml->form_tmp = apr_pstrcat(r->pool,
+                           hdml->form_tmp,
+                           "\" ",NULL);
+  hdml->form_tmp = apr_pstrcat(r->pool,
+                           hdml->form_tmp,
+                           "POSTDATA=\"", NULL);
+
+  return hdml->out;
+}
+
+/**
+ * handler of the form end tag. 
+ *
+ * @param hdml [i/o] The pointer to the HDML structure at the output
+ *                   destination is specified.
+ * @param child [i]  unused.
+ * @return The HDML output result after it edits it is returned. 
+ */
+static char*
+hdml_1_0_end_form_tag(Hdml* hdml, Node* child) 
+{
+  request_rec* r = hdml->doc->r;
+
+  qs_output_to_postdata(hdml, "_chxj_dmy=");
+
+  hdml->form_tmp = apr_pstrcat(r->pool, 
+                             hdml->form_tmp,
+                             hdml->postdata[hdml->pure_form_cnt],
+                             NULL);
+
+  hdml->form_tmp = apr_pstrcat(r->pool,
+                               hdml->form_tmp,
+                               "\" CLEAR=TRUE >\n", 
+                               NULL);
+  hdml->form_tmp = apr_pstrcat(r->pool,
+                               hdml->form_tmp,
+                               "</NODISPLAY>\n",
+                               NULL);
+
+  qs_output_to_hdml_card(hdml, hdml->form_tmp);
+
+  hdml->form_tmp = NULL;
+  hdml->pure_form_cnt++;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler that takes charge of the processing of the input tag. 
+ *
+ * @param hdml [i/o] The pointer to the HDML structure at the output
+ *                   destination is specified.
+ * @param node [i]   The tag node to be processed is specified. 
+ */
+static char*
+hdml_1_0_start_input_tag(Hdml* hdml, Node* node) 
+{
+  Doc* doc = hdml->doc;
+  Attr* attr;
+
+  /*--------------------------------------------------------------------------*/
+  /* The attribute of the input tag is acquired.                              */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "type") == 0) 
+    {
+      if (strcasecmp(value, "text") == 0)
+      {
+        /*--------------------------------------------------------------------*/
+        /* "input type ='text'" tag is processed.                             */
+        /*--------------------------------------------------------------------*/
+        hdml_do_input_text_tag(hdml, node);
+      }
+      if (strcasecmp(value, "password") == 0) 
+      {
+        /*--------------------------------------------------------------------*/
+        /* "input type='password'" tag is processed.                          */
+        /*--------------------------------------------------------------------*/
+        hdml_do_input_password_tag(hdml, node);
+      }
+      else
+      if (strcasecmp(value, "submit") == 0) 
+      {
+        /*--------------------------------------------------------------------*/
+        /* "input type='submit'" tag is processed.                            */
+        /*--------------------------------------------------------------------*/
+        hdml_do_input_submit_tag(hdml, node);
+      }
+      else 
+      if (strcasecmp(value, "hidden") == 0) 
+      {
+        /*--------------------------------------------------------------------*/
+        /* "input type='hidden'" tag is processed.                            */
+        /*--------------------------------------------------------------------*/
+        hdml_do_input_hidden_tag(hdml, node);
+      }
+      else
+      if (strcasecmp(value, "radio") == 0) 
+      {
+        /*--------------------------------------------------------------------*/
+        /* "input type='radio'" tag is processed.                             */
+        /*--------------------------------------------------------------------*/
+        hdml_do_input_radio_tag(hdml, node);
+      }
+      else 
+      if (strcasecmp(value, "checkbox") == 0) 
+      {
+        /*--------------------------------------------------------------------*/
+        /* "input type='checkbox'" tag is processed.                          */
+        /*--------------------------------------------------------------------*/
+        hdml_do_input_checkbox_tag(hdml, node);
+      }
+    }
+    else 
+    if (strcasecmp(name, "name")      == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "value")     == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "size")      == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "maxlength") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "checked")   == 0) 
+    {
+      /* ignore */
+    }
+    else 
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "istyle")    == 0) 
+    {
+      /* ignore */
+    }
+  }
+  return hdml->out;
+}
+
+/**
+ * The substitution processing of tag "input type = text" is done. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure at the output 
+ *                   destination is specified. 
+ * @param tag  [i]   The tag node of input type=text is specified. 
+ */
+static void
+hdml_do_input_text_tag(Hdml* hdml, Node* tag)
+{
+  Doc*          doc   = hdml->doc;
+  request_rec*  r     = doc->r;
+  char*         mlen;
+  char*         val;
+  char*         is;
+  char*         nm;
+  char*         fmt;
+  int           ii;
+  hdml_tag_output_upper_half(hdml, tag);
+
+  hdml->card_cnt++;
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool,
+                          "<A TASK=GOSUB LABEL=\93ü\97Í DEST=#D%d "
+                          "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
+                          hdml->card_cnt,
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt],
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt]
+                  ));
+
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool, "[$%s%02d]</A>\n"  , 
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt]));
+
+  /*--------------------------------------------------------------------------*/
+  /* ENTRY CARD is output here.                                               */
+  /*--------------------------------------------------------------------------*/
+  qs_output_to_hdml_card(hdml, "<ENTRY NAME="                               );
+  qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
+  qs_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V "                         );
+
+  mlen = NULL;
+  is   = NULL;
+  val  = NULL;
+  fmt  = NULL;
+  nm = qs_get_name_attr(doc, tag, r);
+  if (nm == NULL)
+  {
+    nm = qs_alloc_zero_byte_string(r);
+  }
+
+  qs_output_to_postdata(hdml, 
+                  apr_psprintf(r->pool, 
+                          "%s=$%s%02d", 
+                          nm,
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt]));
+
+  mlen = qs_get_maxlength_attr  (doc, tag, r);
+  is   = qs_get_istyle_attr     (doc, tag, r);
+  val  = qs_get_value_attr      (doc, tag, r);
+
+  fmt  = qs_conv_istyle_to_format(r, is);
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "qs_conv_istyle_to_format end");
+        
+  if (fmt != NULL) 
+  {
+    if (mlen != NULL) 
+    {
+      for (ii=0; ii<strlen(mlen); ii++)
+      {
+        if (mlen[ii] < '0' || mlen[ii] > '9')
+        {
+          mlen = apr_psprintf(r->pool, "0");
+          break;
+        }
+      }
+      qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
+    }
+    else 
+    {
+      qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt)       );
+    }
+  }
+
+  qs_output_to_hdml_card(hdml, 
+                  " MARKABLE=FALSE>\n"
+                  "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
+                  "</ENTRY>\n");
+
+  if (val != NULL) 
+  {
+    qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, "%s%02d=%s", 
+                        qs_get_form_no(r, hdml),
+                        hdml->var_cnt[hdml->pure_form_cnt],
+                        ap_escape_uri(r->pool,val)));
+  }
+  else 
+  {
+    qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, "%s%02d=", 
+                        qs_get_form_no(r, hdml),
+                        hdml->var_cnt[hdml->pure_form_cnt]));
+  }
+  hdml->var_cnt[hdml->pure_form_cnt]++;
+}
+
+/**
+ * The substitution processing of tag "input type = password" is done. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure at the output 
+ *                   destination is specified. 
+ * @param tag  [i]   The tag node of input type=password is specified. 
+ */
+static void
+hdml_do_input_password_tag(Hdml* hdml, Node* tag)
+{
+  Doc*            doc = hdml->doc;
+  request_rec*    r   = doc->r;
+  char*           mlen;
+  char*           val;
+  char*           is;
+  char*           nm;
+  char*           fmt;
+  hdml_tag_output_upper_half(hdml, tag);
+
+  hdml->card_cnt++;
+  qs_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=\93ü\97Í DEST="              );
+  qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool, "VARS=\"V=$%s%02d\" ", 
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt]));
+
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool, "RECEIVE=%s%02d>"  , 
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt]));
+  qs_output_to_hdml_out(hdml, "[****]</A>\n"          );
+
+  qs_output_to_hdml_card(hdml, "<ENTRY NAME="                               );
+  qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
+  qs_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V "                         );
+
+  mlen = NULL;
+  is   = NULL;
+  val  = NULL;
+  fmt  = NULL;
+
+  nm = qs_get_name_attr(doc, tag, r);
+  if (nm == NULL)
+  {
+    nm = qs_alloc_zero_byte_string(r);
+  }
+  qs_output_to_postdata(hdml, 
+                  apr_psprintf(r->pool, 
+                          "%s=$%s%02d", 
+                          nm,
+                          qs_get_form_no(r, hdml),
+                          hdml->var_cnt[hdml->pure_form_cnt]));
+
+  mlen = qs_get_maxlength_attr  (doc, tag, r);
+  val  = qs_get_value_attr      (doc, tag, r);
+  /*--------------------------------------------------------------------------*/
+  /* Default is a figure input.                                               */
+  /*--------------------------------------------------------------------------*/
+  fmt = apr_psprintf(r->pool, "N");
+  if (mlen != NULL) 
+  {
+    if (chxj_chk_numeric(mlen) != 0)
+    {
+      mlen = apr_psprintf(r->pool, "0");
+    }
+    qs_output_to_hdml_card(hdml, 
+                    apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
+  }
+  else 
+  {
+    qs_output_to_hdml_card(hdml, 
+                    apr_psprintf(r->pool, " FORMAT=*%s", fmt)       );
+  }
+  qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
+
+  qs_output_to_hdml_card(hdml, 
+                  " MARKABLE=FALSE>\n"
+                  "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
+                  "</ENTRY>\n");
+
+  if (val != NULL) 
+  {
+    qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, "%s%02d=%s", 
+                        qs_get_form_no(r, hdml),
+                        hdml->var_cnt[hdml->pure_form_cnt], 
+                        ap_escape_uri(r->pool,val)));
+  }
+  else 
+  {
+    qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, "%s%02d=", 
+                        qs_get_form_no(r, hdml),
+                        hdml->var_cnt[hdml->pure_form_cnt]));
+  }
+  hdml->var_cnt[hdml->pure_form_cnt]++;
+}
+
+/**
+ * The substitution processing of tag "input type = submit" is done. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure at the output 
+ *                   destination is specified. 
+ * @param tag  [i]   The tag node of input type=submit is specified. 
+ */
+static void
+hdml_do_input_submit_tag(Hdml* hdml, Node* tag)
+{
+  Doc*          doc = hdml->doc;
+  request_rec*  r   = doc->r;
+  char*         nm  = NULL;
+  char*         val = NULL;
+  hdml_tag_output_upper_half(hdml, tag);
+
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool, 
+                          "<A TASK=GO LABEL=OK DEST=#F%d ",
+                          hdml->pure_form_cnt));
+
+  /*--------------------------------------------------------------------------*/
+  /* get name and value attribute                                             */
+  /*--------------------------------------------------------------------------*/
+  nm  = qs_get_name_attr  (doc, tag, r);
+  val = qs_get_value_attr (doc, tag, r);
+
+  if (nm != NULL && val != NULL) 
+  {
+    qs_output_to_hdml_out(hdml, 
+                    apr_psprintf(r->pool, "VARS=\"%s=%s\" ", 
+                            nm, 
+                            ap_escape_uri(r->pool,val)));
+    if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) 
+    {
+      qs_output_to_postdata(hdml, apr_psprintf(r->pool,"%s=$%s", nm, nm));
+    }
+  }
+  qs_output_to_hdml_out(hdml, ">"         );
+  qs_output_to_hdml_out(hdml, val);
+  qs_output_to_hdml_out(hdml, "</A>\n"    );
+}
+
+/**
+ * The substitution processing of tag "input type = hidden" is done. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure at the output 
+ *                   destination is specified. 
+ * @param tag  [i]   The tag node of input type=hidden is specified. 
+ */
+static void
+hdml_do_input_hidden_tag(Hdml* hdml, Node* tag)
+{
+  Doc*          doc = hdml->doc;
+  request_rec*  r   = doc->r;
+  char*         nm  = NULL;
+  char*         val = NULL;
+
+  /*--------------------------------------------------------------------------*/
+  /* get name and value attribute                                             */
+  /*--------------------------------------------------------------------------*/
+  nm  = qs_get_name_attr  (doc, tag, r);
+  val = qs_get_value_attr (doc, tag, r);
+
+  if (nm != NULL && val != NULL) 
+  {
+    qs_output_to_postdata(hdml, 
+                    apr_psprintf(r->pool, 
+                            "%s=%s", 
+                            nm, 
+                            ap_escape_uri(r->pool, val)));
+  }
+}
+
+/**
+ * The substitution processing of tag "input type = radio" is done. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure at the output 
+ *                   destination is specified. 
+ * @param tag  [i]   The tag node of input type=radio is specified. 
+ */
+static void
+hdml_do_input_radio_tag(Hdml* hdml, Node* tag)
+{
+  Doc*          doc       = hdml->doc;
+  request_rec*  r         = doc->r;
+  char*         nm        = NULL;
+  char*         val       = NULL;
+  int           ii;
+  int           jj;
+  int           kk;
+  int           r_cnt;
+  hdml_tag_output_upper_half(hdml, tag);
+
+  /*--------------------------------------------------------------------------*/
+  /* get name and value attribute                                             */
+  /*--------------------------------------------------------------------------*/
+  nm  = qs_get_name_attr  (doc, tag, r);
+  val = qs_get_value_attr (doc, tag, r);
+
+  /*--------------------------------------------------------------------------*/
+  /* The same name is searched out from the list made beforehand.             */
+  /*--------------------------------------------------------------------------*/
+  for (ii=0; ii<MAX_RADIO_COUNT; ii++) 
+  {
+    if (hdml->radio_name_list[ii] == NULL) 
+    {
+      /* @todo Oops..  */
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, 
+                      "%s:%d Oops... radio list is null", 
+                      APLOG_MARK);
+      /*----------------------------------------------------------------------*/
+      /* Processing is ended because it doesn't happen off the fly.           */
+      /*----------------------------------------------------------------------*/
+      return;
+    }
+
+    if (strcasecmp(hdml->radio_name_list[ii], nm) == 0) 
+    {
+      break;
+    }
+  }
+  if (ii == MAX_RADIO_COUNT) 
+  {
+    /* @todo Oops.. */
+    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, 
+                    "%s:%d Oops... The same name was not in the list. ", 
+                    APLOG_MARK);
+    /*------------------------------------------------------------------------*/
+    /* Processing is ended because it doesn't happen off the fly.             */
+    /*------------------------------------------------------------------------*/
+    return;
+  }
+
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool, 
+                          "<A TASK=GOSUB "
+                          "LABEL=\"\93ü\97Í\" "
+                          "DEST=#R%d VARS=\"VAL=%s\" "
+                          "RECEIVE=\"%s;", 
+                          ii, 
+                          val, 
+                          nm));
+
+  if (hdml->radio_out_cnt[ii] == 0) 
+  {
+    qs_output_to_hdml_card(hdml, 
+                    apr_psprintf(r->pool,
+                            "<NODISPLAY NAME=R%d>\n",
+                            ii));
+    qs_output_to_hdml_card(hdml, 
+                    apr_psprintf(r->pool, 
+                            "<ACTION "
+                            "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
+  }
+
+  kk = hdml->radio_out_cnt[ii];
+  for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) 
+  {
+    if (hdml->radio_value_list[ii][jj] == NULL) 
+    {
+      break;
+    }
+  }
+  r_cnt = jj;
+
+  for (jj=0; jj<r_cnt; jj++) 
+  {
+    if (hdml->radio_value_list[ii][jj] == NULL)
+    {
+      break;
+    }
+    if (jj != 0) 
+    {
+      qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
+      if (hdml->radio_out_cnt[ii] == 0) 
+      {
+        qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
+      }
+    }
+
+    qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
+    if (hdml->radio_out_cnt[ii] == 0) 
+    {
+      if (jj == 0) 
+      {
+        qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
+      }
+      else 
+      {
+        qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
+      }
+    }
+    kk++;
+    if (kk >= r_cnt) 
+    {
+      kk=0;
+    }
+  }
+  qs_output_to_hdml_out(hdml, 
+                  apr_psprintf(r->pool, "\" >$%s_%02d</A>", 
+                          nm, 
+                          hdml->radio_out_cnt[ii]));
+  if (hdml->radio_out_cnt[ii] == 0) 
+  {
+    qs_output_to_hdml_card(hdml, "\">\n"         );
+    qs_output_to_hdml_card(hdml, "</NODISPLAY>\n");
+
+    qs_output_to_postdata(hdml,  apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
+
+    for (jj=0; jj<r_cnt; jj++) 
+    {
+      if (hdml->radio_value_list[ii][jj] != NULL 
+      &&  hdml->radio_checked_value[ii] != NULL) 
+      {
+        if (strcasecmp(hdml->radio_value_list[ii][jj], 
+                       hdml->radio_checked_value[ii]) == 0)
+        {
+          qs_output_to_init_vars(hdml, 
+                          apr_psprintf(r->pool, 
+                                  "%s_%02d=X", 
+                                  nm, 
+                                  jj));
+        }
+        else 
+        {
+          qs_output_to_init_vars(hdml, 
+                          apr_psprintf(r->pool, 
+                                  "%s_%02d=_", 
+                                  nm, 
+                                  jj));
+        }
+      }
+      else 
+      {
+        qs_output_to_init_vars(hdml, 
+                        apr_psprintf(r->pool, 
+                                "%s_%02d=_", 
+                                nm, 
+                                jj));
+      }
+    }
+
+    if (hdml->radio_checked_value[ii] != NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                    "radio button is checked. checked value is [%s]", 
+                    hdml->radio_checked_value[ii]);
+      qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, 
+                            "%s=%s", 
+                            nm, 
+                            hdml->radio_checked_value[ii]));
+    }
+    else
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                    "radio button is not checked. checked value is []");
+      qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, 
+                            "%s=", 
+                            nm));
+    }
+  }
+  hdml->radio_out_cnt[ii]++;
+}
+
+/**
+ * The substitution processing of tag "input type = checkbox" is done. 
+ * 
+ * @param hdml [i/o] The pointer to the HDML structure at the output 
+ *                   destination is specified. 
+ * @param tag  [i]   The tag node of input type=checkbox is specified. 
+ */
+static void
+hdml_do_input_checkbox_tag(Hdml* hdml, Node* tag)
+{
+  Doc*          doc       = hdml->doc;
+  request_rec*  r         = doc->r;
+  char*         nm        = NULL;
+  char*         val       = NULL;
+  int           chk;
+
+  /*--------------------------------------------------------------------------*/
+  /* It is posted to the one without the checked attribute.                   */
+  /* However, they were able to be removed with INPUT FILTER.                 */
+  /*--------------------------------------------------------------------------*/
+  if (hdml->has_checkbox == 0) 
+  {
+    hdml->has_checkbox++;
+    qs_output_to_hdml_card(hdml, 
+                    "<NODISPLAY NAME=\"_chk\">\n"
+                    "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
+                                             "RETVALS=\"_uchk;$V;X\" >\n"
+                    "</NODISPLAY>\n"
+                    "<NODISPLAY NAME=\"_uchk\">\n"
+                    "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
+                                             "RETVALS=\"_chk;;_\" >\n"
+                    "</NODISPLAY>\n"
+                    );
+  }
+        
+  /*--------------------------------------------------------------------------*/
+  /* It is examined whether it is CHECKED.                                    */
+  /*--------------------------------------------------------------------------*/
+  chk = qs_is_checked_checkbox_attr(doc, tag, r);
+
+  /*--------------------------------------------------------------------------*/
+  /* The value of the name attribute and the value attribute is acquired      */
+  /* respectively.                                                            */
+  /*--------------------------------------------------------------------------*/
+  val = qs_get_value_attr(doc, tag, r);
+  nm  = qs_get_name_attr(doc, tag, r);
+
+  if (val == NULL) 
+  {
+    val    = qs_alloc_zero_byte_string(r);
+  }
+  if (nm == NULL)
+  {
+    nm   = qs_alloc_zero_byte_string(r);
+  }
+  qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, 
+                                "<A TASK=GOSUB LABEL=\"Áª¯¸\" "
+                                   "DEST=\"#$%s%02d\" "
+                                   "VARS=\"V=%s\" "
+                                   "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
+                                   "$%s%02d</A>\n",
+                                qs_get_form_no(r, hdml),
+                                hdml->var_cnt[hdml->pure_form_cnt] + 0,
+                                val,
+                                qs_get_form_no(r, hdml),
+                                hdml->var_cnt[hdml->pure_form_cnt] + 0,
+                                qs_get_form_no(r, hdml),
+                                hdml->var_cnt[hdml->pure_form_cnt] + 1,
+                                qs_get_form_no(r, hdml),
+                                hdml->var_cnt[hdml->pure_form_cnt] + 2,
+                                qs_get_form_no(r, hdml),
+                                hdml->var_cnt[hdml->pure_form_cnt] + 2));
+  if (chk) 
+  {
+    qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, 
+                            "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
+                            qs_get_form_no(r, hdml),
+                            hdml->var_cnt[hdml->pure_form_cnt] + 0,
+                            qs_get_form_no(r, hdml),
+                            hdml->var_cnt[hdml->pure_form_cnt] + 1,
+                            ap_escape_uri(r->pool,val),
+                            qs_get_form_no(r, hdml),
+                            hdml->var_cnt[hdml->pure_form_cnt] + 2
+                            ));
+  }
+  else
+  {
+    qs_output_to_init_vars(hdml, 
+                    apr_psprintf(r->pool, 
+                            "%s%02d=_chk&%s%02d=&%s%02d=_",
+                            qs_get_form_no(r, hdml),
+                            hdml->var_cnt[hdml->pure_form_cnt] + 0,
+                            qs_get_form_no(r, hdml),
+                            hdml->var_cnt[hdml->pure_form_cnt] + 1,
+                            qs_get_form_no(r, hdml),
+                            hdml->var_cnt[hdml->pure_form_cnt] + 2
+                            ));
+  }
+
+  qs_output_to_postdata(hdml, 
+                  apr_psprintf(r->pool, "%s%s=$%s%02d",
+                                  CHECK_BOX_PREFIX,
+                                  nm,
+                                  qs_get_form_no(r, hdml),
+                                  hdml->var_cnt[hdml->pure_form_cnt] + 1));
+  hdml->var_cnt[hdml->pure_form_cnt] += 3;
+}
+
+/**
+ * The ISTYLE attribute is converted into the HDML form.
+ *
+ * @param r    [i]   To use POOL, the pointer to request_rec is specified.
+ * @param is   [i]   The value of the ISTYLE attribute is specified. 
+ * @return The ISTYLE attribute converted into the HDML form is returned. 
+ */
+char*
+qs_conv_istyle_to_format(request_rec* r, char* is)
+{
+  char* fmt;
+  if (is == NULL)
+  {
+    return NULL;
+  }
+
+  if (strcasecmp(is, "1") == 0)
+  {
+    fmt = apr_psprintf(r->pool, "M");
+  }
+  else
+  if (strcasecmp(is, "2") == 0)
+  {
+    fmt = apr_psprintf(r->pool, "M");
+  }
+  else
+  if (strcasecmp(is, "3") == 0)
+  {
+    fmt = apr_psprintf(r->pool, "m");
+  }
+  else
+  if (strcasecmp(is, "4") == 0)
+  {
+    fmt = apr_psprintf(r->pool, "N");
+  }
+  else 
+  {
+    return NULL;
+  }
+  return fmt;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_end_input_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_start_center_tag(Hdml* hdml, Node* node) 
+{
+  hdml->center++;
+  hdml->in_center++;
+
+  if (hdml->hdml_br_flag == 0) 
+  {
+    hdml = qs_output_to_hdml_out(hdml, "<BR>\n");
+  }
+  hdml = qs_output_to_hdml_out(hdml, "<CENTER>");
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_end_center_tag(Hdml* hdml, Node* child) 
+{
+  hdml->center = 0;
+  hdml->in_center = 0;
+
+  hdml = qs_output_to_hdml_out(hdml, "<BR>\n");
+  hdml->hdml_br_flag = 1;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_start_hr_tag(Hdml* hdml, Node* node) 
+{
+  if (hdml->hdml_br_flag == 0) 
+  {
+    qs_output_to_hdml_out(hdml, "<BR>\n");
+    if (hdml->in_center > 0) 
+    {
+      hdml->in_center--;
+    }
+    else
+    if (hdml->div_in_center > 0)
+    {
+      hdml->div_in_center--;
+    }
+  }
+
+  qs_output_to_hdml_out(hdml, "<CENTER>\84\9f\84\9f\84\9f\84\9f\84\9f\84\9f\84\9f\84\9f<BR>\n");
+
+  hdml->hdml_br_flag = 1;
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_end_hr_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_start_img_tag(Hdml* hdml, Node* node) 
+{
+  Doc*          doc  = hdml->doc;
+#ifndef IMG_NOT_CONVERT_FILENAME
+  device_table* spec = hdml->spec;
+#endif
+  Attr*         attr;
+
+  hdml_tag_output_upper_half(hdml, node);
+
+  qs_output_to_hdml_out(hdml, "<img");
+
+  /* Get Attributes */
+  for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "src") == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " src=\"");
+#ifdef IMG_NOT_CONVERT_FILENAME
+      qs_output_to_hdml_out(hdml, value    );
+#else
+      qs_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
+#endif
+      qs_output_to_hdml_out(hdml, "\""     );
+    }
+    else 
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " align=\"" );
+      qs_output_to_hdml_out(hdml, value       );
+      qs_output_to_hdml_out(hdml, "\""        );
+    }
+    else
+    if (strcasecmp(name, "width" ) == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " width=\"");
+      qs_output_to_hdml_out(hdml, value      );
+      qs_output_to_hdml_out(hdml, "\""       );
+    }
+    else
+    if (strcasecmp(name, "height") == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " height=\"");
+      qs_output_to_hdml_out(hdml, value       );
+      qs_output_to_hdml_out(hdml, "\""        );
+    }
+    else
+    if (strcasecmp(name, "hspace") == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " hspace=\"");
+      qs_output_to_hdml_out(hdml, value       );
+      qs_output_to_hdml_out(hdml, "\""        );
+    }
+    else
+    if (strcasecmp(name, "vspace") == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " vspace=\"");
+      qs_output_to_hdml_out(hdml, value       );
+      qs_output_to_hdml_out(hdml, "\""        );
+    }
+    else
+    if (strcasecmp(name, "alt"   ) == 0) 
+    {
+      qs_output_to_hdml_out(hdml, " alt=\""   );
+      qs_output_to_hdml_out(hdml, value       );
+      qs_output_to_hdml_out(hdml, "\""        );
+    }
+  }
+  qs_output_to_hdml_out(hdml, ">"             );
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+hdml_1_0_end_img_tag(Hdml* hdml, Node* child) 
+{
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char* 
+hdml_1_0_start_select_tag(Hdml* hdml, Node* node)  
+{
+  Doc*         doc = hdml->doc;
+  request_rec* r   = doc->r;
+  Attr*        attr;
+
+  hdml_tag_output_upper_half(hdml, node);
+
+  hdml->card_cnt++;
+
+  qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, 
+                                   "<A TASK=GOSUB LABEL=\91I\91ð "
+                                   "VARS=\"V=$%s%02d\" DEST=#D%d "
+                                   "RECEIVE=\"%s%02d;%s%02d\">"
+                                   "$%s%02d</A>\n",
+                                   qs_get_form_no(r, hdml),
+                                   hdml->var_cnt[hdml->pure_form_cnt]+0, 
+                                   hdml->card_cnt,
+                                   qs_get_form_no(r, hdml),
+                                   hdml->var_cnt[hdml->pure_form_cnt]+0, 
+                                   qs_get_form_no(r, hdml),
+                                   hdml->var_cnt[hdml->pure_form_cnt]+1, 
+                                   qs_get_form_no(r, hdml),
+                                   hdml->var_cnt[hdml->pure_form_cnt]+1));
+
+  qs_output_to_hdml_card(hdml, 
+                  apr_psprintf(r->pool, 
+                          "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
+  qs_output_to_hdml_card(hdml, 
+                  apr_psprintf(r->pool, 
+                          "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\n"));
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node); 
+       attr != NULL; 
+       attr=qs_get_next_attr(doc,attr)) 
+  {
+    char* name      = qs_get_attr_name(doc,attr);
+    char* value     = qs_get_attr_value(doc,attr);
+    char* selval    = NULL;
+    char* selvaltxt = NULL;
+    if (strcasecmp(name, "name") == 0) 
+    {
+
+      qs_output_to_postdata(hdml, 
+                      apr_psprintf(r->pool, "%s=$%s%02d", 
+                              value,
+                              qs_get_form_no(r, hdml),
+                              hdml->var_cnt[hdml->pure_form_cnt]));
+      selval = qs_get_selected_value(doc, node, r);
+      if (selval == NULL) 
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                        "selected value not found");
+        selval = qs_alloc_zero_byte_string(r);
+      }
+      else
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                        "selected value found[%s]" , selval);
+      }
+      selvaltxt = qs_get_selected_value_text(doc, node, r);
+      if (selvaltxt == NULL)
+      {
+        selvaltxt = qs_alloc_zero_byte_string(r);
+      }
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "selvaltxt:[%s]" ,selvaltxt);
+
+      qs_output_to_init_vars(hdml, 
+                      apr_psprintf(r->pool, 
+                              "%s%02d=%s&%s%02d=%s",
+                              qs_get_form_no(r, hdml),
+                              hdml->var_cnt[hdml->pure_form_cnt] + 0,
+                              selval, 
+                              qs_get_form_no(r, hdml),
+                              hdml->var_cnt[hdml->pure_form_cnt] + 1,
+                              selvaltxt));
+
+      hdml->var_cnt[hdml->pure_form_cnt] += 2;
+      break;
+    }
+  }
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char* 
+hdml_1_0_end_select_tag(Hdml* hdml,  Node* node)  
+{
+  qs_output_to_hdml_card(hdml, "</CHOICE>\n");
+
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char* 
+hdml_1_0_start_option_tag(Hdml* hdml, Node* node) 
+{
+  request_rec* r     = hdml->doc->r;
+  Doc*         doc   = hdml->doc;
+  Node*        child;
+  char*        val;
+  char*        txtval;
+
+  hdml->card_cnt++;
+
+  hdml->option_flag = 1;
+  val = qs_get_value_attr(doc, node, r);
+
+  /*--------------------------------------------------------------------------*/
+  /* The child node of the object tag node acquires the value in assumption   */
+  /* that is the TEXT node.                                                   */
+  /*--------------------------------------------------------------------------*/
+  child = qs_get_child_node(doc, node);
+  if (child == NULL) 
+  {
+    txtval    = apr_palloc(r->pool, 1);
+    txtval[0] = 0;
+  }
+  else 
+  {
+    txtval = qs_get_node_value(doc, child);
+  }
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "txtval:[%s]" , txtval);
+
+  if (val != NULL && txtval != NULL) 
+  {
+    qs_output_to_hdml_card(hdml, 
+                    apr_psprintf(r->pool, 
+                            "<CE TASK=RETURN VALUE=\"%s\" "
+                            "RETVALS=\"$V;%s\">%s</CE>\n", 
+                            val, 
+                            qs_trim_string(r,txtval), 
+                            qs_trim_string(r,txtval)));
+  }
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char* 
+hdml_1_0_end_option_tag(Hdml* hdml,  Node* node)  
+{
+  hdml->option_flag = 0;
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char* 
+hdml_1_0_start_div_tag(Hdml* hdml, Node* node) 
+{
+  Doc*    doc   = hdml->doc;
+  Attr*   attr;
+
+  /*--------------------------------------------------------------------------*/
+  /* If the br tag is not output immediately before the div tag appears, the  */
+  /* br tag is output.                                                        */
+  /*--------------------------------------------------------------------------*/
+  if (hdml->hdml_br_flag == 0)
+  {
+    hdml->hdml_br_flag = 1;
+    qs_output_to_hdml_out(hdml, "<BR>\n");
+  }
+
+  /*--------------------------------------------------------------------------*/
+  /* The object tag node is scanned.                                          */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node); 
+       attr != NULL; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "align") == 0) 
+    {
+      if (strcasecmp(value, "right") == 0) 
+      {
+        hdml->div_right_flag = 1;
+        qs_output_to_hdml_out(hdml, "<RIGHT>");
+        hdml->hdml_br_flag = 0;
+        break;
+      }
+      else if (strcasecmp(value, "center") == 0)
+      {
+        hdml->div_center_flag = 1;
+        qs_output_to_hdml_out(hdml, "<CENTER>");
+        hdml->hdml_br_flag = 0;
+        break;
+      }
+    }
+  }
+  return hdml->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char* 
+hdml_1_0_end_div_tag(Hdml* hdml,  Node* node)  
+{
+  request_rec* r = hdml->doc->r;
+
+
+  if (hdml->div_right_flag == 1) 
+  {
+    qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
+    hdml->div_right_flag = 0;
+  }
+  if (hdml->div_center_flag == 1) 
+  {
+    qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
+    hdml->div_center_flag = 0;
+    hdml->div_in_center   = 0;
+  }
+  return hdml->out;
+}
+
+
+/**
+ * It is a wrapper of the apr_pstrcat function. 
+ *
+ * @param r    [i]   To use POOL, the pointer to request_rec is specified.
+ * @param o    [i]   The character string of connected origin is specified.
+ * @param s    [i]   The character string connected with 'o' parameter is 
+ *                   specified.
+ * @param len  [i/o] The pointer to the area where the character string 
+ *                   length is stored is specified. 
+ * @return The character string after it connects it is returned. 
+ */
+char*
+qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len)
+{
+  *len = (strlen(s) + *len);
+  return apr_pstrcat(r->pool, o, s, NULL);
+}
+
+/**
+ * The prepositive character string used to generate the variable for HDML is 
+ * generated. 
+ *
+ * @param r    [i]   To use POOL, the pointer to request_rec is specified.
+ * @param hdml [i]   The pointer to the HDML structure that maintains the seed 
+ *                   to generate it is specified.
+ * @return The character string after it generates it is returned. 
+ */
+static char*
+qs_get_form_no(request_rec* r, Hdml* hdml) 
+{
+  char *result;
+  int  fc = hdml->form_cnt + hdml->pure_form_cnt;
+
+  result = apr_pcalloc(r->pool, 4);
+  memset(result, 0, 4);
+
+  result[0] = 'A' + ((fc / 100) % 26);
+  result = apr_pstrcat(r->pool, result, 
+                  apr_psprintf(r->pool, "%02d", (fc % 100)), NULL);
+  return result;
+}
+
+/**
+ * The number of tag nodes .."Input type =' radio '".. is counted. 
+ *
+ * @param hdml [i] The pointer to the HDML structure is specified.
+ * @param node [i] The first parents node that counts the radio tag node is 
+ *                 specified. 
+ */
+static void
+hdml_1_0_count_radio_tag(Hdml* hdml, Node* node) 
+{
+  Node*         child;
+  Doc*          doc       = hdml->doc; 
+  request_rec*  r         = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* All the child nodes of the specified node are scanned.                   */
+  /*--------------------------------------------------------------------------*/
+  for (child =  qs_get_child_node(doc,node); 
+       child != NULL; 
+       child =  qs_get_next_node(doc,child)) 
+  {
+    char*     type;
+    char*     rname;
+    char*     rvalue;
+    char*     chkd;
+    char*     name;
+    int       ii;
+    int       jj;
+
+    name = qs_get_node_name(doc,child);
+    if (strcasecmp(name, "input") != 0)
+    {
+      hdml_1_0_count_radio_tag(hdml, child);
+      continue;
+    }
+
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "found input tag");
+    type = qs_get_type_attr(doc, child, r);
+    if (type == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_ERR,0,r,
+        "Oops! The input tag without the type attribute has been found."
+        "Please give a type.");
+      continue;
+    }
+    if (strcasecmp(type, "radio") != 0)
+    {
+      continue;
+    }
+
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "found type=radio");
+    rname  = qs_get_name_attr (doc, child, r);
+    rvalue = qs_get_value_attr(doc, child, r);
+    if (rname == NULL)
+    {
+      /*----------------------------------------------------------------------*/
+      /* Oops!. The input tag without the name attribute has been found.      */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+        "Oops!. The input tag without the name attribute has been found."
+        "Please give a name.");
+      continue;
+    }
+
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "found name attribute");
+    /*------------------------------------------------------------------------*/
+    /* It scans in radio_name_list. When the same value exists, the           */
+    /* value is overwrited.                                                   */
+    /* The value is written in a new area when not is.                        */
+    /*------------------------------------------------------------------------*/
+    for (ii=0; ii<MAX_RADIO_COUNT; ii++) 
+    {
+      if (hdml->radio_name_list[ii] == NULL) 
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                        "new name:[%s]", rname);
+        break;
+      }
+      if (strcasecmp(hdml->radio_name_list[ii], rname) == 0) 
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                        "already registered name:[%s]", rname);
+        break;
+      }
+    }
+    if (ii == MAX_RADIO_COUNT)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                      apr_psprintf(r->pool,
+                        "I do not understand the name of the radiobutton "
+                        "of %d piece or more. Please decrease "
+                        "the number of radiobuttons.",
+                        MAX_RADIO_COUNT));
+      continue;
+    }
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "add radio name:[%s]" ,rname);
+    hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
+
+    /*------------------------------------------------------------------------*/
+    /* It adds it to radio_value_list.                                        */
+    /*------------------------------------------------------------------------*/
+    for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
+    {
+      if (hdml->radio_value_list[ii][jj] == NULL) 
+      {
+        break;
+      }
+    }
+    if (jj == MAX_RADIO_VALUE_COUNT)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                      apr_psprintf(r->pool,
+                        "I do not understand the value of the radiobutton "
+                        "of %d piece or more. Please decrease "
+                        "the number of radiobuttons.",
+                        MAX_RADIO_VALUE_COUNT));
+      continue;
+    }
+    hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
+
+    /*------------------------------------------------------------------------*/
+    /* Now let's be the checked attribute or scan.                            */
+    /*------------------------------------------------------------------------*/
+    chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
+    if (chkd != NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      apr_psprintf(r->pool,
+                              "The tag scanned now had the checked "
+                              "attribute. The value is [%s].",
+                              rvalue));
+      hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
+    }
+  }
+}
+
+/**
+ * The character string is added, and output to the out member of the HDML 
+ * structure.
+ *
+ * @param hdml [i/o] The pointer to the HDML structure that maintains the out 
+ *                   member at the output destination is specified. 
+ * @param s    [i]   The character string that should be output is specified. 
+ * @return The pointer to the HDML structure after it processes it is returned.
+ */
+static Hdml* 
+qs_output_to_hdml_out(Hdml* hdml, char* s)
+{
+  hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
+  return hdml;
+}
+
+/**
+ * The character string is added, and output to the card member of the HDML 
+ * structure.
+ *
+ * @param hdml [i/o] The pointer to the HDML structure that maintains the 
+ *                   card member at the output destination is specified. 
+ * @param s    [i]   The character string that should be output is specified. 
+ * @return The pointer to the HDML structure after it processes it is returned.
+ */
+static Hdml*
+qs_output_to_hdml_card(Hdml* hdml, char* s)
+{
+  hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
+  return hdml;
+}
+
+/**
+ * The data for the post is added, and output. 
+ *
+ * @param hdml [i/o] The pointer to the HDML structure at the output
+ *                    destination is specified.
+ * @param s    [i]   The character string that wants to output to postdata is 
+ *                   specified.
+ */
+static void
+qs_output_to_postdata(Hdml* hdml, char* s)
+{
+  request_rec*          r = hdml->doc->r;
+
+  if (strlen(hdml->postdata[hdml->pure_form_cnt]) != 0)
+  {
+    hdml->postdata[hdml->pure_form_cnt] =
+                  apr_pstrcat(r->pool,
+                              hdml->postdata[hdml->pure_form_cnt],
+                              "&",
+                              NULL);
+  }
+  hdml->postdata[hdml->pure_form_cnt] =
+          apr_pstrcat(r->pool, 
+                          hdml->postdata[hdml->pure_form_cnt],
+                          qs_trim_string(r, s),
+                          NULL);
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                  "POSTDATA:[%s]", 
+                  hdml->postdata[hdml->pure_form_cnt] );
+}
+
+/**
+ * The tag output upper half.
+ *
+ * @param hdml   [i/o] The pointer to the HDML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ */
+static void
+hdml_tag_output_upper_half(Hdml* hdml, Node* node)
+{
+  if (hdml->hdml_br_flag   == 1 
+  &&  hdml->div_right_flag == 1) 
+  {
+    qs_output_to_hdml_out(hdml, "<RIGHT>");
+    hdml->hdml_br_flag = 0;
+  }
+
+  if (hdml->hdml_br_flag == 1 
+  &&  hdml->center > 0 
+  &&  hdml->in_center == 0) 
+  {
+    qs_output_to_hdml_out(hdml, "<CENTER>");
+    hdml->in_center++;
+    hdml->hdml_br_flag = 0;
+  }
+  else
+  if (hdml->hdml_br_flag == 1 
+  &&  hdml->div_center_flag > 0 
+  &&  hdml->div_in_center == 0) 
+  {
+    qs_output_to_hdml_out(hdml, "<CENTER>");
+    hdml->div_in_center++;
+    hdml->hdml_br_flag = 0;
+  }
+}
+
+/**
+ * The data for the init_vars is added, and output.
+ *
+ * @param hdml [i/o] The pointer to the HDML structure at the output
+ *                    destination is specified.
+ * @param s    [i]   The character string that wants to output to postdata is
+ *                   specified.
+ */
+static void
+qs_output_to_init_vars(Hdml* hdml, char* s)
+{
+  request_rec*    r = hdml->doc->r;
+
+  if (strlen(hdml->init_vars) > 0)
+  {
+    hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
+  }
+  hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r,s), NULL);
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                  "INIT_VARS:[%s]",
+                  hdml->init_vars);
+}
+
+static void
+hdml_1_0_chxjif_tag(Hdml* hdml, Node* node)
+{
+  Doc*         doc   = hdml->doc;
+  Node*        child;
+
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    qs_output_to_hdml_out(hdml, child->otext);
+    hdml_1_0_chxjif_tag(hdml, child);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_hdml.h b/src/chxj_hdml.h
new file mode 100644 (file)
index 0000000..6627b83
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_HDML_H__
+#define __CHXJ_HDML_H__
+
+/*============================================================================*/
+/* The maximum number of form is up to ten.                                   */
+/*============================================================================*/
+#define MAX_FORM_COUNT  (10)
+#define MAX_RADIO_COUNT (10)
+#define MAX_RADIO_VALUE_COUNT (100)
+#define END_LINE        "\0"
+
+#include "mod_chxj.h"
+
+/*============================================================================*/
+/* Structure for HDML                                                         */
+/*============================================================================*/
+typedef struct Hdml_t {
+  Doc*    doc;
+  char*   out;
+  int     center;
+  int     in_center;
+  char*   card;
+  int     card_cnt;
+  int     form_cnt;
+
+  /*--------------------------------------------------------------------------*/
+  /* If the title tag is found, it becomes ``1''.                             */
+  /*--------------------------------------------------------------------------*/
+  int     found_title;
+  /*--------------------------------------------------------------------------*/
+  /* Counter of pure form tag                                                 */
+  /*--------------------------------------------------------------------------*/
+  int     pure_form_cnt;
+
+  int     var_cnt[MAX_FORM_COUNT];
+  char*   postdata[MAX_FORM_COUNT];
+  /*------------------------------*/
+  /* max <input type="radio"> tag */
+  /*------------------------------*/
+  char*   radio_value_list[MAX_RADIO_COUNT][MAX_RADIO_VALUE_COUNT];
+  char*   radio_name_list[MAX_RADIO_COUNT];
+  int     radio_out_cnt[MAX_RADIO_COUNT];
+  char*   radio_checked_value[MAX_RADIO_COUNT];
+  /*---------------------------------*/
+  /* for <input type="checkbox"> tag */
+  /*---------------------------------*/
+  int     has_checkbox;
+
+  char*   form_tmp;
+  char*   init_vars;
+  int     out_len;
+  int     card_len;
+
+  /*------------------------------*/
+  /* Counter for variable of HDML */
+  /*------------------------------*/
+  int     qs_cnt;
+  int     option_flag;
+  int     div_right_flag;
+  int     div_center_flag;
+  int     div_in_center;
+  int     hdml_a_flag;
+  int     hdml_br_flag;
+
+  int     hdml_end_flag;
+
+  device_table* spec;
+
+  mod_chxj_config* conf;
+} Hdml;
+/*============================================================================*/
+/* Prototype declaration.                                                     */
+/*============================================================================*/
+char* chxj_exchange_hdml(request_rec* r, device_table *spec, const char* src, apr_size_t srclen, apr_size_t* dstlen) ;
+char* qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len);
+char* qs_conv_istyle_to_format(request_rec* r, char* is);
+#endif
diff --git a/src/chxj_img_conv.c b/src/chxj_img_conv.c
new file mode 100644 (file)
index 0000000..2c4da05
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "mod_chxj.h"
+
+
+char* 
+chxj_img_conv(request_rec* r, device_table* spec, const char* s)
+{
+  char* dst = apr_pstrdup(r->pool, s);
+  if (spec != NULL)
+  {
+    switch (spec->color) 
+    {
+    case 2       : dst = apr_pstrcat(r->pool, dst,".10", NULL); break;
+    case 4       : dst = apr_pstrcat(r->pool, dst,".20", NULL); break;
+    case 256     : dst = apr_pstrcat(r->pool, dst,".30", NULL); break;
+    case 4096    : dst = apr_pstrcat(r->pool, dst,".40", NULL); break;
+    case 65536   : dst = apr_pstrcat(r->pool, dst,".50", NULL); break;
+    case 262144  : dst = apr_pstrcat(r->pool, dst,".60", NULL); break;
+    case 15680000: dst = apr_pstrcat(r->pool, dst,".70", NULL); break;
+    default:       dst = apr_pstrcat(r->pool, dst,".30", NULL); break;
+    }
+    if (spec->available_jpeg != 0)
+    {
+      return apr_pstrcat(r->pool, dst,".jpg", NULL);
+    }
+
+    if (spec->available_png != 0)
+    {
+      return apr_pstrcat(r->pool, dst,".png", NULL);
+    }
+
+    if (spec->available_gif != 0)
+    {
+      return apr_pstrcat(r->pool, dst, ".gif", NULL);
+    }
+
+    if (spec->available_bmp4 != 0 || spec->available_bmp2 != 0)
+    {
+      return apr_pstrcat(r->pool, dst, ".bmp", NULL);
+    }
+  }
+  return dst;
+}
diff --git a/src/chxj_img_conv.h b/src/chxj_img_conv.h
new file mode 100644 (file)
index 0000000..a7b1b06
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_IMG_CONV_H__
+#define __CHXJ_IMG_CONV_H__
+#include "mod_chxj.h"
+
+char* chxj_img_conv(request_rec* r, device_table* spec, const char* s);
+#endif
diff --git a/src/chxj_jhtml.c b/src/chxj_jhtml.c
new file mode 100644 (file)
index 0000000..d50927b
--- /dev/null
@@ -0,0 +1,1864 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_jhtml.h"
+#include "chxj_hdml.h"
+#include "chxj_dump.h"
+#include "chxj_img_conv.h"
+
+static char* jhtml_node_exchange    (Jhtml* jhtml, Node* node, int indent);
+static char* jhtml_start_html_tag   (Jhtml* jhtml, Node* child);
+static char* jhtml_end_html_tag     (Jhtml* jhtml, Node* child);
+static char* jhtml_start_meta_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_end_meta_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_start_head_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_end_head_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_start_title_tag  (Jhtml* jhtml, Node* node);
+static char* jhtml_end_title_tag    (Jhtml* jhtml, Node* node);
+static char* jhtml_start_base_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_end_base_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_start_body_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_end_body_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_start_a_tag      (Jhtml* jhtml, Node* node);
+static char* jhtml_end_a_tag        (Jhtml* jhtml, Node* node);
+static char* jhtml_start_br_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_end_br_tag       (Jhtml* jhtml, Node* node);
+static char* jhtml_start_font_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_end_font_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_start_form_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_end_form_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_start_input_tag  (Jhtml* jhtml, Node* node);
+static char* jhtml_end_input_tag    (Jhtml* jhtml, Node* node);
+static char* jhtml_start_center_tag (Jhtml* jhtml, Node* node);
+static char* jhtml_end_center_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_start_hr_tag     (Jhtml* jhtml, Node* node);
+static char* jhtml_end_hr_tag       (Jhtml* jhtml, Node* node);
+static char* jhtml_start_img_tag    (Jhtml* jhtml, Node* node);
+static char* jhtml_end_img_tag      (Jhtml* jhtml, Node* node);
+static char* jhtml_start_select_tag (Jhtml* jhtml, Node* node);
+static char* jhtml_end_select_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_start_option_tag (Jhtml* jhtml, Node* node);
+static char* jhtml_end_option_tag   (Jhtml* jhtml, Node* node);
+static char* jhtml_start_div_tag    (Jhtml* jhtml, Node* node);
+static char* jhtml_end_div_tag      (Jhtml* jhtml, Node* node);
+static void chxj_init_jhtml(Jhtml* jhtml, Doc* doc, request_rec* r, device_table* spec);
+static int jhtml_search_emoji(Jhtml* jhtml, char* txt, char** rslt);
+static char* chxj_istyle_to_mode(request_rec* r, const char* s);
+static void jhtml_1_0_chxjif_tag(Jhtml* jhtml, Node* node); 
+
+/**
+ * converts from CHTML5.0 to JHTML.
+ *
+ * @param r     [i]   Requet_rec is appointed.
+ * @param spec  [i]   The result of the device specification processing which 
+ *                    was done in advance is appointed.
+ * @param src   [i]   The character string before the converting is appointed.
+ * @return The character string after the converting is returned.
+ */
+char*
+chxj_exchange_jhtml(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen)
+{
+  char*     dst = NULL;
+  char*     ss;
+  Jhtml   jhtml;
+  Doc       doc;
+
+  /*--------------------------------------------------------------------------*/
+  /* The CHTML structure is initialized.                                      */
+  /*--------------------------------------------------------------------------*/
+  chxj_init_jhtml(&jhtml, &doc, r, spec);
+
+  /*--------------------------------------------------------------------------*/
+  /* The character string of the input is analyzed.                           */
+  /*--------------------------------------------------------------------------*/
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  ss = apr_pcalloc(r->pool, srclen + 1);
+  memset(ss, 0, srclen + 1);
+  memcpy(ss, src, srclen);
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML -> JHTML", ss, srclen);
+#endif
+  qs_parse_string(&doc,ss);
+
+  /*--------------------------------------------------------------------------*/
+  /* It converts it from CHTML to JHTML.                                      */
+  /*--------------------------------------------------------------------------*/
+  dst = jhtml_node_exchange(&jhtml, qs_get_root(&doc), 0);
+  qs_all_free(&doc,QX_LOGMARK);
+
+  if (dst == NULL) 
+  {
+    return apr_pstrdup(r->pool,ss);
+  }
+
+  if (strlen(dst) == 0)
+  {
+    dst = apr_psprintf(r->pool, "\n");
+  }
+  *dstlen = strlen(dst);
+#ifdef DUMP_LOG
+  chxj_dump_out("[dst] CHTML -> JHTML", dst, *dstlen);
+#endif
+  return dst;
+}
+
+/**
+ * The CHTML structure is initialized.
+ *
+ * @param jhtml [i/o] The pointer to the JHTML structure that wants to be
+ *                   initialized is specified.
+ * @param doc   [i]   The Doc structure that should be set to the initialized
+ *                   JHTML structure is specified.
+ * @param r     [i]   To use POOL, the pointer to request_rec is specified.
+ * @param spec  [i]   The pointer to the device_table
+ */
+static void
+chxj_init_jhtml(Jhtml* jhtml, Doc* doc, request_rec* r, device_table* spec)
+{
+  memset(doc,   0, sizeof(Doc));
+  memset(jhtml, 0, sizeof(Jhtml));
+
+  doc->r      = r;
+  jhtml->doc  = doc;
+  jhtml->spec = spec;
+  jhtml->out  = qs_alloc_zero_byte_string(r);
+  jhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+}
+
+/**
+ * It is main processing of conversion from CHTML to JHTML. 
+ *
+ * @param jhtml   [i/o] The pointer to the CHTML structure is specified. 
+ * @param node    [i]   The pointer to a current node is specified. 
+ * @param indent  [i]   The depth of the node processing it now is specified. 
+ *
+ * @return The character string after it converts it is returned. 
+ */
+static char*
+jhtml_node_exchange(Jhtml* jhtml, Node* node, int indent) 
+{
+  Node*         child;
+  Doc*          doc   = jhtml->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* It is the main loop of the conversion processing.                        */
+  /*--------------------------------------------------------------------------*/
+  for (child = qs_get_child_node(doc,node);
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <HTML>                                                                 */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "html") == 0) 
+    {
+      jhtml_start_html_tag(jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_html_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <META>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "meta") == 0) 
+    {
+      jhtml_start_meta_tag(jhtml, child);
+      jhtml_end_meta_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HEAD>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "head") == 0) 
+    {
+      jhtml_start_head_tag(jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_head_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <TITLE>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "title") == 0) 
+    {
+      jhtml_start_title_tag (jhtml, child);
+      jhtml_node_exchange   (jhtml, child,indent+1);
+      jhtml_end_title_tag   (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BASE>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "base") == 0) 
+    {
+      jhtml_start_base_tag(jhtml, child);
+      jhtml_end_base_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BODY>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "body") == 0) 
+    {
+      jhtml_start_body_tag(jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_body_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <A>                                                                    */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "a") == 0) 
+    {
+      jhtml_start_a_tag   (jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_a_tag     (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "br") == 0) 
+    {
+      jhtml_start_br_tag  (jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_br_tag    (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FONT>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "font") == 0) 
+    {
+      jhtml_start_font_tag(jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_font_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FORM>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "form") == 0) 
+    {
+      jhtml_start_form_tag(jhtml, child);
+      jhtml_node_exchange (jhtml, child,indent+1);
+      jhtml_end_form_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <INPUT>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "input") == 0) 
+    {
+      jhtml_start_input_tag (jhtml, child);
+      jhtml_node_exchange   (jhtml, child,indent+1);
+      jhtml_end_input_tag   (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "hr") == 0) 
+    {
+      jhtml_start_hr_tag  (jhtml, child);
+      jhtml_end_hr_tag    (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CENTER>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "center") == 0) 
+    {
+      jhtml_start_center_tag(jhtml, child);
+      jhtml_node_exchange   (jhtml, child,indent+1);
+      jhtml_end_center_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <IMG>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "img") == 0) 
+    {
+      jhtml_start_img_tag (jhtml, child);
+      jhtml_end_img_tag   (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <SELECT>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "select") == 0)
+    {
+      jhtml_start_select_tag(jhtml, child);
+      jhtml_node_exchange   (jhtml, child, indent+1);
+      jhtml_end_select_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <OPTION>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "option") == 0)
+    {
+      jhtml_start_option_tag(jhtml, child);
+      jhtml_node_exchange   (jhtml, child, indent+1);
+      jhtml_end_option_tag  (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <DIV>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "div") == 0)
+    {
+      jhtml_start_div_tag (jhtml, child);
+      jhtml_node_exchange (jhtml, child, indent+1);
+      jhtml_end_div_tag   (jhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BLINK>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "blink") == 0)
+    {
+      /* ignore */
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CHXJ:IF>                                                              */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "chxj:if") == 0)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
+      if (chxj_chxjif_is_mine(jhtml->spec, doc, child))
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
+        jhtml_1_0_chxjif_tag(jhtml, child);
+      }
+    }
+    /*------------------------------------------------------------------------*/
+    /* NORMAL TEXT                                                            */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      char*   textval;
+      char*   tmp;
+      char*   tdst;
+      char    one_byte[2];
+      int     ii;
+      int     tdst_len;
+
+      textval = qs_get_node_value(doc,child);
+      textval = qs_trim_string(jhtml->doc->r, textval);
+      if (strlen(textval) == 0)
+      {
+        continue;
+      }
+
+      tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
+      memset(tmp, 0, qs_get_node_size(doc,child)+1);
+
+      tdst     = qs_alloc_zero_byte_string(r);
+      memset(one_byte, 0, sizeof(one_byte));
+      tdst_len = 0;
+
+      for (ii=0; ii<qs_get_node_size(doc,child); ii++)
+      {
+        char* out;
+        int rtn = jhtml_search_emoji(jhtml, &textval[ii], &out);
+        if (rtn != 0)
+        {
+          tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
+          ii+=(rtn - 1);
+          continue;
+        }
+        if (is_sjis_kanji(textval[ii]))
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          one_byte[0] = textval[ii+1];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          ii++;
+        }
+        else if (textval[ii] != '\r' && textval[ii] != '\n')
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+        }
+      }
+      jhtml->out = apr_pstrcat(r->pool, jhtml->out, tdst, NULL);
+    }
+  }
+  return jhtml->out;
+}
+
+/**
+ * Corresponding EMOJI to a current character-code is retrieved. 
+ * The substitution character string is stored in the rslt pointer if agreeing.
+ *
+ * @param jhtml   [i]   The pointer to the CHTML structure is specified. 
+ * @param txt     [i]   The character string to want to examine whether it is 
+ *                      EMOJI is specified. 
+ * @param rslt    [o]   The pointer to the pointer that stores the result is 
+ *                      specified. 
+ * @return When corresponding EMOJI exists, it returns it excluding 0. 
+ */
+static int
+jhtml_search_emoji(Jhtml* jhtml, char* txt, char** rslt)
+{
+  emoji_t*      ee;
+  request_rec*  r;
+  device_table* spec;
+  int           len;
+
+  spec = jhtml->spec;
+
+  len = strlen(txt);
+  r = jhtml->doc->r;
+
+  if (spec == NULL)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
+  }
+
+  for (ee = jhtml->conf->emoji;
+       ee;
+       ee = ee->next) 
+  {
+    unsigned char hex1byte;
+    unsigned char hex2byte;
+    if (ee->imode == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "emoji->imode is NULL");
+      continue;
+    }
+    hex1byte = ee->imode->hex1byte & 0xff;
+    hex2byte = ee->imode->hex2byte & 0xff;
+
+    if (ee->imode->string != NULL
+    &&  strlen(ee->imode->string) > 0
+    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_psprintf(r->pool,"\e%s\ f", ee->jphone->string);
+        return strlen(ee->imode->string);
+      }
+
+      return 0;
+    }
+    if (len >= 2
+    && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
+    && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte))
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_psprintf(r->pool,"\e%s\ f", ee->jphone->string);
+        return 2;
+      }
+
+      return 0;
+    }
+  }
+  return 0;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_html_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc   = jhtml->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* start HTML tag                                                           */
+  /*--------------------------------------------------------------------------*/
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<html>\n", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_html_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</html>\n", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_meta_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<meta", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name   = qs_get_attr_name(doc,attr);
+    char* value  = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "http-equiv") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " http-equiv=\"", 
+                      value,
+                      "\"",
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "content") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " content=\"", 
+                      value,
+                      "\"",
+                      NULL);
+    }
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_meta_tag(Jhtml* jhtml, Node* child) 
+{
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_head_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<head>\r\n", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_head_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</head>\r\n", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_title_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<title>", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_title_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</title>\r\n", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_base_tag(Jhtml* jhtml, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = jhtml->doc;
+  request_rec*  r     = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<base", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "href") == 0) 
+    {
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >\r\n", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_base_tag(Jhtml* jhtml, Node* child) 
+{
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_body_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<body", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value  = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "bgcolor") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " bgcolor=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " text=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "link") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " link=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "alink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "vlink") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\r\n", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_body_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</body>\r\n", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_a_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc   = jhtml->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<a", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "name") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " name=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "href") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML1.0                                                             */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " accesskey=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "cti") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 2.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " cti=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "ijam") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /* It is special only for CHTML.                                        */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " utn ", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "telbook") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+    else
+    if (strcasecmp(name, "kana") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+    else
+    if (strcasecmp(name, "email") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+    else
+    if (strcasecmp(name, "ista") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ilet") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "iswf") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "irst") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_a_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</a>", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_br_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<br>\r\n", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_br_tag(Jhtml* jhtml, Node* child) 
+{
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_font_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc   = jhtml->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<font", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "color") == 0) 
+    {
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " color=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_font_tag(Jhtml* jhtml, Node* child) 
+{
+  request_rec* r = jhtml->doc->r;
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</font>", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_form_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<form", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "action") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " action=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "method") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " method=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 3.0                                                            */
+      /* It is special only for CHTML.                                        */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " utn ", 
+                      NULL);
+    }
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_form_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</form>", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_input_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc         = jhtml->doc;
+  request_rec*  r           = doc->r;
+  char*         max_length  = NULL;
+  char*         type        = NULL;
+  char*         name        = NULL;
+  char*         value       = NULL;
+  char*         istyle      = NULL;
+  char*         size        = NULL;
+  char*         checked     = NULL;
+  char*         accesskey   = NULL;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<input", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+
+  type       = qs_get_type_attr(doc, node, r);
+  name       = qs_get_name_attr(doc, node, r);
+  value      = qs_get_value_attr(doc,node,r);
+  istyle     = qs_get_istyle_attr(doc,node,r);
+  max_length = qs_get_maxlength_attr(doc,node,r);
+  checked    = qs_get_checked_attr(doc,node,r);
+  accesskey  = qs_get_accesskey_attr(doc, node, r);
+  size       = qs_get_size_attr(doc, node, r);
+
+  if (type != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool,
+                    jhtml->out, 
+                    " type=\"", 
+                    type, 
+                    "\" ", 
+                    NULL);
+  }
+  if (size != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " size=\"", 
+                    size, 
+                    "\" ", 
+                    NULL);
+  }
+  if (name != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " name=\"", 
+                    name, 
+                    "\" ", 
+                    NULL);
+  }
+  if (value != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " value=\"", 
+                    value, 
+                    "\" ", 
+                    NULL);
+  }
+  if (accesskey != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " accesskey=\"", 
+                    accesskey, "\" ", 
+                    NULL);
+  }
+  if (istyle != NULL)
+  {
+    /*------------------------------------------------------------------------*/
+    /* CHTML 2.0                                                              */
+    /*------------------------------------------------------------------------*/
+    if (type != NULL && strcasecmp(type, "password") == 0)
+    {
+      jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " mode=\"", 
+                    "numeric", "\" ", 
+                    NULL);
+    }
+    else
+    {
+      jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " mode=\"", 
+                    chxj_istyle_to_mode(r,istyle), "\" ", 
+                    NULL);
+    }
+  }
+  else
+  if (istyle == NULL && type != NULL && strcasecmp(type, "password") == 0)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, 
+                    " mode=\"", 
+                    "numeric", "\" ", 
+                    NULL);
+  }
+  /*--------------------------------------------------------------------------*/
+  /* The figure is default for the password.                                  */
+  /*--------------------------------------------------------------------------*/
+  if (max_length != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, 
+                      " maxlength=\"", 
+                      max_length, 
+                      "\"", 
+                      NULL);
+  }
+
+  if (checked != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, " checked ", NULL);
+  }
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_input_tag(Jhtml* jhtml, Node* child) 
+{
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_center_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<center>", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_center_tag(Jhtml* jhtml, Node* child) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</center>", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_hr_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<hr ", NULL);
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "align") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool,
+                        jhtml->out, 
+                        " align=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool,
+                        jhtml->out, 
+                        " size=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "width") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool,
+                        jhtml->out, 
+                        " width=\"", value, "\" ", NULL);
+    }
+    else
+    if (strcasecmp(name, "noshade") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool,
+                        jhtml->out, 
+                        " noshade ", NULL);
+    }
+    else
+    if (strcasecmp(name, "color") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, " >", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_hr_tag(Jhtml* jhtml, Node* child) 
+{
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_img_tag(Jhtml* jhtml, Node* node) 
+{
+  Doc*          doc = jhtml->doc;
+  request_rec*  r   = doc->r;
+  Attr* attr;
+#ifndef IMG_NOT_CONVERT_FILENAME
+  device_table* spec = jhtml->spec;
+#endif
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<img", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "src") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+#ifdef IMG_NOT_CONVERT_FILENAME
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " src=\"",value,"\"", NULL);
+#else
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " src=\"", chxj_img_conv(r,spec,value), NULL);
+      jhtml->out = apr_pstrcat(r->pool, jhtml->out, "\"", NULL);
+#endif
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " align=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "width" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " width=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "height") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " height=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "hspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " hspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "vspace") == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " vspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "alt"   ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0                                                            */
+      /*----------------------------------------------------------------------*/
+      jhtml->out = apr_pstrcat(r->pool, 
+                      jhtml->out, " alt=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 4.0                                                            */
+      /*----------------------------------------------------------------------*/
+      /* ignore */
+    }
+  }
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_img_tag(Jhtml* jhtml, Node* child) 
+{
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_select_tag(Jhtml* jhtml, Node* child)
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* size      = NULL;
+  char* name      = NULL;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<select", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "size") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      size = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "name") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      name = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "multiple") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      /* not support */
+    }
+  }
+
+  if (size != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, jhtml->out, " size=\"",size,"\"", NULL);
+  }
+  if (name != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, jhtml->out, " name=\"",name,"\"", NULL);
+  }
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">\n", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_select_tag(Jhtml* jhtml, Node* child)
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</select>\n", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_option_tag(Jhtml* jhtml, Node* child)
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* selected   = NULL;
+  char* value      = NULL;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<option", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "selected") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      selected = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "value") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      value = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (value != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"",value,"\"", NULL);
+  }
+  else
+  {
+    jhtml->out = apr_pstrcat(r->pool, jhtml->out, " value=\"\"", NULL);
+  }
+
+  if (selected != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, jhtml->out, " selected ", NULL);
+  }
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_option_tag(Jhtml* jhtml, Node* child)
+{
+  /* Don't close */
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_start_div_tag(Jhtml* jhtml, Node* child)
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* align   = NULL;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "<div", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "align") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 (W3C version 3.2)                                          */
+      /*----------------------------------------------------------------------*/
+      align = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (align != NULL)
+  {
+    jhtml->out = apr_pstrcat(r->pool, 
+                    jhtml->out, " align=\"", align, "\"", NULL);
+  }
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, ">", NULL);
+  return jhtml->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param jhtml  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+jhtml_end_div_tag(Jhtml* jhtml, Node* child)
+{
+  Doc* doc = jhtml->doc;
+  request_rec* r = doc->r;
+
+  jhtml->out = apr_pstrcat(r->pool, jhtml->out, "</div>\n", NULL);
+
+  return jhtml->out;
+}
+
+static char*
+chxj_istyle_to_mode(request_rec* r, const char* s)
+{
+  char* tmp;
+  if (strcasecmp(s, "1") == 0)
+  {
+    return apr_psprintf(r->pool, "hiragana");
+  }
+  else
+  if (strcasecmp(s, "2") == 0)
+  {
+    return apr_psprintf(r->pool, "hankakukana");
+  }
+  else
+  if (strcasecmp(s, "3") == 0)
+  {
+    return apr_psprintf(r->pool, "alphabet");
+  }
+  else
+  if (strcasecmp(s, "4") == 0)
+  {
+    return apr_psprintf(r->pool, "numeric");
+  }
+
+  tmp = apr_palloc(r->pool, 1);
+  tmp[0] = '\0';
+  return apr_pstrdup(r->pool,tmp);
+}
+
+static void
+jhtml_1_0_chxjif_tag(Jhtml* jhtml, Node* node)
+{
+  Doc*         doc   = jhtml->doc;
+  Node*        child;
+  request_rec* r     = doc->r;
+
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    jhtml->out = apr_pstrcat(r->pool, jhtml->out, child->otext, NULL);
+    jhtml_1_0_chxjif_tag(jhtml, child);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_jhtml.h b/src/chxj_jhtml.h
new file mode 100644 (file)
index 0000000..8d30bc2
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_JHTML_H__
+#define __CHXJ_JHTML_H__
+
+/* #define DUMP_JHTML "" */
+#include "mod_chxj.h"
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _Jhtml_t {
+    Doc* doc;
+    char* out;
+    int   out_len;
+
+    device_table* spec;
+    mod_chxj_config* conf;
+} Jhtml;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char*
+chxj_exchange_jhtml(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen);
+#endif
diff --git a/src/chxj_load_device_data.c b/src/chxj_load_device_data.c
new file mode 100644 (file)
index 0000000..f366a96
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "mod_chxj.h"
+#include <qs_ignore_sp.h>
+#include <qs_log.h>
+#include <qs_malloc.h>
+#include <qs_parse_attr.h>
+#include <qs_parse_file.h>
+#include <qs_parse_string.h>
+#include <qs_parse_tag.h>
+#include "chxj_load_device_data.h"
+#include "chxj_str_util.h"
+
+
+static void set_devices_data(Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node) ;
+static void set_user_agent_data(Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node) ;
+static void set_device_data(Doc* doc, apr_pool_t* p, device_table_list* dtl, Node* node) ;
+/**
+ * load device_data.xml
+ */
+void
+chxj_load_device_data(Doc* doc, apr_pool_t *p, mod_chxj_config* conf) 
+{
+  conf->devices = NULL;
+  set_devices_data(doc, p, conf,qs_get_root(doc));
+#if 0
+  do {
+    FILE* fp = fopen("/tmp/load_device.log", "a");
+    device_table_list* ll = conf->devices;
+    for (;ll; ll= ll->next)
+    {
+      device_table* dt;
+      fprintf(fp, "user_agent:[%s]\n", ll->pattern);
+      for (dt = ll->table; dt; dt = dt->next)
+      {
+        fprintf(fp, "device_id:[%s] ", dt->device_id);
+        fprintf(fp, "device_name:[%s] ", dt->device_name);
+        fprintf(fp, "html_spec_type:[%d] ", dt->html_spec_type);
+        fprintf(fp, "width:[%d] ", dt->width);
+        fprintf(fp, "heigh:[%d] ", dt->heigh);
+        fprintf(fp, "color:[%d] ", dt->color);
+        fprintf(fp, "\n");
+      }
+    }
+    fclose(fp);
+    break;
+  } while(0);
+#endif
+}
+
+/**
+ * <devices>
+ */
+static void
+set_devices_data(Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node) 
+{
+  Node* child;
+  for (child = qs_get_child_node(doc,node); 
+       child ; 
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+    if (strcasecmp(name, "devices") == 0) 
+    {
+      set_user_agent_data(doc, p, conf, child);
+    }
+  }
+}
+
+/**
+ * <user_agent>
+ */
+static void
+set_user_agent_data(Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node) 
+{
+  Node* child;
+  device_table_list* t;
+
+  for (child = qs_get_child_node(doc,node);
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    if (strcasecmp(name, "user_agent") == 0 ) 
+    {
+      Attr* attr;
+      device_table_list* dtl;
+
+      if (conf->devices == NULL) 
+      {
+        conf->devices = apr_pcalloc(p, sizeof(device_table_list));
+        conf->devices->next    = NULL;
+        conf->devices->pattern = NULL;
+        conf->devices->table   = NULL;
+        conf->devices->tail    = NULL;
+        dtl = conf->devices;
+      }
+      else 
+      {
+        for (t = conf->devices; t ; t = t->next) 
+        {
+          if (t->next == NULL) 
+          {
+            break;
+          }
+        }
+        t->next = apr_pcalloc(p, sizeof(device_table_list));
+        t->next->next = NULL;
+        t->next->pattern = NULL;
+        t->next->table = NULL;
+        t->next->tail = NULL;
+        dtl = t->next;
+      }
+
+      for (attr = qs_get_attr(doc,child); attr ; attr = qs_get_next_attr(doc,attr)) 
+      {
+        if (strcasecmp(qs_get_attr_name(doc,attr), "pattern") == 0) 
+        {
+            dtl->pattern = apr_pstrdup(p, qs_get_attr_value(doc,attr));
+        }
+      }
+      set_device_data(doc, p, dtl, child);
+    }
+  }
+}
+
+static void
+set_device_data(Doc* doc, apr_pool_t* p, device_table_list* dtl, Node* node) 
+{
+  Node* child;
+  device_table* dt;
+
+  dt = apr_pcalloc(p, sizeof(device_table));
+  dt->next = NULL;
+  for (child = qs_get_child_node(doc,node); 
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+    if (strcasecmp(name, "device") == 0) 
+    {
+      set_device_data(doc,p, dtl, child);
+    }
+    else
+    if (strcasecmp(name, "device_id") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL 
+      &&  strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        dt->device_id = apr_pstrdup(p, qs_get_node_value(doc, ch));
+      }
+    }
+    else
+    if (strcasecmp(name, "device_name") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL 
+      &&  strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        dt->device_name = apr_pstrdup(p, qs_get_node_value(doc, ch));
+      }
+    }
+    else
+    if (strcasecmp(name, "html_spec_type") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL 
+      &&  strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char* vv = qs_get_node_value(doc, ch);
+        if (strcasecmp(vv, "xhtml_mobile_1_0") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_XHtml_Mobile_1_0;
+        }
+        else
+        if (strcasecmp(vv, "chtml_1_0") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Chtml_1_0;
+        }
+        else
+        if (strcasecmp(vv, "chtml_2_0") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Chtml_2_0;
+        }
+        else
+        if (strcasecmp(vv, "chtml_3_0") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Chtml_3_0;
+        }
+        else
+        if (strcasecmp(vv, "chtml_4_0") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Chtml_4_0;
+        }
+        else
+        if (strcasecmp(vv, "chtml_5_0") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Chtml_5_0;
+        }
+        else
+        if (strcasecmp(vv, "hdml") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Hdml;
+        }
+        else
+        if (strcasecmp(vv, "jhtml") == 0) 
+        {
+          dt->html_spec_type = CHXJ_SPEC_Jhtml;
+        }
+      }
+    }
+    else 
+    if (strcasecmp(name, "width") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        int ii;
+        for (ii=0; ii<strlen(vv); ii++) 
+        {
+          if ((vv[ii] >= '1' && vv[ii] <= '9') || vv[ii] == '0') 
+          {
+            continue;
+          }
+          break;
+        }
+        if (ii == strlen(vv)) 
+        {
+          dt->width = atoi(qs_get_node_value(doc,ch));
+        }
+        else 
+        {
+          dt->width = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "heigh") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        int ii;
+        for (ii=0; ii<strlen(vv); ii++) 
+        {
+          if ((vv[ii] >= '1' && vv[ii] <= '9') || vv[ii] == '0') 
+          {
+            continue;
+          }
+          break;
+        }
+        if (ii == strlen(vv)) 
+        {
+          dt->heigh = atoi(qs_get_node_value(doc,ch));
+        }
+        else 
+        {
+          dt->heigh = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "gif") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        if (strcasecmp(vv, "true") == 0) 
+        {
+          dt->available_gif = 1;
+        }
+        else
+        {
+          dt->available_gif = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "jpeg") == 0 || strcasecmp(name, "jpg") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        if (strcasecmp(vv, "true") == 0) 
+        {
+          dt->available_jpeg = 1;
+        }
+        else 
+        {
+          dt->available_jpeg = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "png") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        if (strcasecmp(vv, "true") == 0) 
+        {
+          dt->available_png = 1;
+        }
+        else
+        {
+          dt->available_png = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "bmp2") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        if (strcasecmp(vv, "true") == 0) 
+        {
+          dt->available_bmp2 = 1;
+        }
+        else
+        {
+          dt->available_bmp2 = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "bmp4") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        if (strcasecmp(vv, "true") == 0) 
+        {
+          dt->available_bmp4 = 1;
+        }
+        else
+        {
+          dt->available_bmp4 = 0;
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "color") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        char *vv = qs_get_node_value(doc,ch);
+        if (chxj_chk_numeric(vv) != 0)
+        {
+          dt->color = 0;
+        }
+        else 
+        {
+          dt->color = chxj_atoi(vv);
+        }
+      }
+    }
+    else
+    if (strcasecmp(name, "emoji_type") == 0) 
+    {
+      Node* ch = qs_get_child_node(doc, child);
+      if (ch != NULL && strcasecmp(qs_get_node_name(doc,ch), "text") == 0) 
+      {
+        dt->emoji_type = apr_pstrdup(p, qs_get_node_value(doc, ch));
+      }
+    }
+  }
+
+  if (dt->device_id != NULL) 
+  {
+    if (dtl->table == NULL) 
+    {
+      dtl->table = dt;
+      dtl->tail = dt;
+    }
+    else 
+    {
+      dtl->tail->next = dt;
+      dtl->tail = dt;
+    }
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_load_device_data.h b/src/chxj_load_device_data.h
new file mode 100644 (file)
index 0000000..e19e555
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __LOAD_DEVICE_DATA_H__
+#define __LOAD_DEVICE_DATA_H__
+#include "mod_chxj.h"
+
+void chxj_load_device_data(Doc* doc, apr_pool_t *p, mod_chxj_config* conf);
+
+#endif
diff --git a/src/chxj_load_emoji_data.c b/src/chxj_load_emoji_data.c
new file mode 100644 (file)
index 0000000..a21ac29
--- /dev/null
@@ -0,0 +1,570 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include "mod_chxj.h"
+#include "chxj_load_emoji_data.h"
+
+#define DEBUG_OUT(X,Y) do {\
+        FILE* fp = fopen("/tmp/load_emoji.log", "a"); \
+        fprintf(fp,X,Y); \
+        fclose(fp); \
+} while(0)
+
+
+static char* load_emoji_set_tag( Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node);
+static char* set_emoji_data( Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node);
+static char* load_emoji_emoji_tag( Doc* doc, apr_pool_t* p, mod_chxj_config* conf, Node* node);
+static void emoji_add_to_tail( mod_chxj_config* conf, emoji_t* emoji);
+static char* load_emoji_no_tag( Doc* doc, apr_pool_t* p, emoji_t* em, Node* node);
+static char* load_emoji_imode_tag( Doc* doc, apr_pool_t* p, emoji_t* em, Node* node);
+static char* load_emoji_ezweb_tag( Doc* doc, apr_pool_t* p, emoji_t* em, Node* node);
+static char* load_emoji_jphone_tag( Doc* doc, apr_pool_t* p, emoji_t* em, Node* node);
+static char hexstring_to_byte(char* s);
+
+/**
+ * load emoji.xml
+ */
+char* 
+chxj_load_emoji_data(
+  Doc* doc,
+  apr_pool_t *p,
+  mod_chxj_config* conf) 
+{
+  char* rtn;
+
+  conf->emoji = NULL;
+  conf->emoji_tail = NULL;
+  rtn = set_emoji_data(doc, p, conf,qs_get_root(doc));
+  if (rtn != NULL)
+  {
+    return rtn;
+  }
+
+#if 0
+  do {
+  emoji_t* ee;
+  for (ee = conf->emoji; ee; ee = ee->next)
+  {
+    DEBUG_OUT("no[%d]", ee->no);
+    DEBUG_OUT("hex1byte[%x]",   0xFF & ee->imode->hex1byte);
+    DEBUG_OUT("hex2byte[%x]",   0xFF & ee->imode->hex2byte);
+    DEBUG_OUT("string[%s]",     ee->imode->string);
+    DEBUG_OUT("description[%s]",ee->imode->description);
+    DEBUG_OUT("typeA[%s]",ee->ezweb->typeA);
+    DEBUG_OUT("typeB[%s]",ee->ezweb->typeB);
+    DEBUG_OUT("typeC[%s]",ee->ezweb->typeC);
+    DEBUG_OUT("typeD[%s]",ee->ezweb->typeD);
+    DEBUG_OUT("jphone[%s]",ee->jphone->string);
+    DEBUG_OUT("%s", "\n");
+  }
+  break;
+  }
+  while(0);
+#endif
+  return NULL;
+}
+
+/**
+ * <emoji>
+ */
+static char*
+set_emoji_data(
+  Doc* doc,
+  apr_pool_t* p,
+  mod_chxj_config* conf,
+  Node* node) 
+{
+  Node* child;
+  char* rtn;
+
+  for (child = qs_get_child_node(doc,node);
+       child;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+    if (strcasecmp(name, "emoji") == 0) 
+    {
+      rtn = load_emoji_emoji_tag(doc, p, conf, child);
+      if (rtn != NULL)
+      {
+        return rtn;
+      }
+    }
+  }
+  return NULL;
+}
+
+static char* 
+load_emoji_emoji_tag(
+  Doc* doc,
+  apr_pool_t* p,
+  mod_chxj_config* conf,
+  Node* node)
+{
+  Node* child;
+  char* rtn;
+  for (child = qs_get_child_node(doc, node);
+       child ;
+       child = qs_get_next_node(doc, child))
+  {
+    char* name = qs_get_node_name(doc, child);
+    if (strcasecmp(name, "set") == 0)
+    {
+      rtn = load_emoji_set_tag(doc, p, conf, child);
+      if (rtn != NULL)
+      {
+        return rtn;
+      }
+    }
+  }
+  return NULL;
+}
+
+
+static char*
+load_emoji_set_tag(
+  Doc* doc,
+  apr_pool_t* p,
+  mod_chxj_config* conf,
+  Node* node)
+{
+  Node* child;
+  emoji_t* em;
+  char* rtn;
+
+  em = apr_palloc(p, sizeof(emoji_t));
+  em->imode = apr_palloc(p, sizeof(imode_emoji));
+  em->ezweb = apr_palloc(p, sizeof(ezweb_emoji));
+  em->jphone = apr_palloc(p, sizeof(jphone_emoji));
+  
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    char* name  = qs_get_node_name(doc, child);
+
+    if (strcasecmp(name, "no") == 0) 
+    {
+      rtn = load_emoji_no_tag(doc, p, em, child);
+      if (rtn != NULL)
+      {
+        return rtn;
+      }
+
+    }
+    else 
+    if (strcasecmp(name, "imode") == 0)
+    {
+      rtn = load_emoji_imode_tag(doc, p, em, child);
+      if (rtn != NULL)
+      {
+        return rtn;
+      }
+    }
+    else
+    if (strcasecmp(name, "ezweb") == 0)
+    {
+      rtn = load_emoji_ezweb_tag(doc, p, em, child);
+      if (rtn != NULL)
+      {
+        return rtn;
+      }
+    }
+    else
+    if (strcasecmp(name, "jphone") == 0)
+    {
+      rtn = load_emoji_jphone_tag(doc, p, em, child);
+      if (rtn != NULL)
+      {
+        return rtn;
+      }
+    }
+  }
+
+  emoji_add_to_tail(conf, em);
+  return NULL;
+}
+
+
+static char*
+load_emoji_no_tag(
+  Doc* doc,
+  apr_pool_t* p,
+  emoji_t* em,
+  Node* node)
+{
+  int len;
+  int ii;
+  Node* child = qs_get_child_node(doc,node);
+  char* name = qs_get_node_name(doc,  child);
+  char* value = qs_get_node_value(doc, child);
+
+  if (strcasecmp(name, "text") == 0)
+  {
+    len = strlen(value);
+
+    for (ii=0; ii<len; ii++)
+    {
+      if (value[ii] < '0' || value[ii] > '9')
+      {
+        return apr_psprintf(p, "invalid data <no> tag [%s]", value);
+      }
+    }
+    em->no = atoi(value);
+  }
+  return NULL;
+}
+
+static char*
+load_emoji_imode_tag(
+  Doc* doc,
+  apr_pool_t* p,
+  emoji_t* em,
+  Node* node)
+{
+  Node* child;
+
+
+  em->imode->hex1byte = 0;
+  em->imode->hex2byte = 0;
+  em->imode->string = NULL;
+  em->imode->description = NULL;
+
+  for (child = qs_get_child_node(doc, node);
+       child ;
+       child = qs_get_next_node(doc, child))
+  {
+    char* name  = qs_get_node_name(doc, child);
+    if (strcasecmp(name, "hex1") == 0) 
+    {
+      Node* hex1node = qs_get_child_node(doc, child);
+      if (hex1node != NULL)
+      {
+        char* cname = qs_get_node_name(doc, hex1node);
+        char* cvalue = qs_get_node_value(doc, hex1node);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->imode->hex1byte = hexstring_to_byte(cvalue);
+        }
+      }
+      else
+      {
+        em->imode->hex1byte    = 0;
+      }
+    }
+    else
+    if (strcasecmp(name, "hex2") == 0)
+    {
+      Node* hex2node = qs_get_child_node(doc, child);
+      if (hex2node != NULL)
+      {
+        char* cname = qs_get_node_name(doc, hex2node);
+        char* cvalue = qs_get_node_value(doc, hex2node);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->imode->hex2byte = hexstring_to_byte(cvalue);
+        }
+      }
+      else
+      {
+        em->imode->hex2byte    = 0;
+      }
+    }
+    else
+    if (strcasecmp(name, "string") == 0)
+    {
+      Node* string_node = qs_get_child_node(doc, child);
+      if (string_node != NULL)
+      {
+        char* cname = qs_get_node_name(doc, string_node);
+        char* cvalue = qs_get_node_value(doc, string_node);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->imode->string = apr_pstrdup(p, cvalue);
+        }
+      }
+      else
+      {
+        em->imode->string    = apr_palloc(p, 1);
+        em->imode->string[0] = 0;
+      }
+    }
+    else
+    if (strcasecmp(name, "description") == 0)
+    {
+      Node* description_node = qs_get_child_node(doc, child);
+      if (description_node != NULL)
+      {
+        char* cname = qs_get_node_name(doc, description_node);
+        char* cvalue = qs_get_node_value(doc, description_node);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->imode->description = apr_pstrdup(p, cvalue);
+        }
+      }
+      else
+      {
+        em->imode->description    = apr_palloc(p, 1);
+        em->imode->description[0] = 0;
+      }
+    }
+  }
+  return NULL;
+}
+
+static char*
+load_emoji_ezweb_tag(
+  Doc* doc,
+  apr_pool_t* p,
+  emoji_t* em,
+  Node* node)
+{
+  Node* child;
+
+
+  em->ezweb->typeA = NULL;
+  em->ezweb->typeB = NULL;
+  em->ezweb->typeC = NULL;
+  em->ezweb->typeD = NULL;
+
+  for (child = qs_get_child_node(doc, node);
+       child ;
+       child = qs_get_next_node(doc, child))
+  {
+    char* name  = qs_get_node_name(doc, child);
+    if (strcasecmp(name, "A") == 0) 
+    {
+      Node* typeAnode = qs_get_child_node(doc, child);
+
+      if (typeAnode != NULL)
+      {
+        char* cname = qs_get_node_name(doc, typeAnode);
+        char* cvalue = qs_get_node_value(doc, typeAnode);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->ezweb->typeA = apr_pstrdup(p,cvalue);
+        }
+      }
+      else
+      {
+        em->ezweb->typeA    = apr_palloc(p, 1);
+        em->ezweb->typeA[0] = 0;
+      }
+    }
+    else
+    if (strcasecmp(name, "B") == 0) 
+    {
+      Node* typeBnode = qs_get_child_node(doc, child);
+
+      if (typeBnode != NULL)
+      {
+        char* cname = qs_get_node_name(doc, typeBnode);
+        char* cvalue = qs_get_node_value(doc, typeBnode);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->ezweb->typeB = apr_pstrdup(p,cvalue);
+        }
+      }
+      else
+      {
+        em->ezweb->typeB    = apr_palloc(p, 1);
+        em->ezweb->typeB[0] = 0;
+      }
+    }
+    else
+    if (strcasecmp(name, "C") == 0) 
+    {
+      Node* typeCnode = qs_get_child_node(doc, child);
+
+      if (typeCnode != NULL)
+      {
+        char* cname = qs_get_node_name(doc, typeCnode);
+        char* cvalue = qs_get_node_value(doc, typeCnode);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->ezweb->typeC = apr_pstrdup(p,cvalue);
+        }
+      }
+      else
+      {
+        em->ezweb->typeC = apr_palloc(p, 1);
+        em->ezweb->typeC[0] = 0;
+      }
+    }
+    else
+    if (strcasecmp(name, "D") == 0) 
+    {
+      Node* typeDnode = qs_get_child_node(doc, child);
+
+      if (typeDnode != NULL)
+      {
+        char* cname = qs_get_node_name(doc, typeDnode);
+        char* cvalue = qs_get_node_value(doc, typeDnode);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          em->ezweb->typeD = apr_pstrdup(p,cvalue);
+        }
+      }
+      else
+      {
+        em->ezweb->typeD = apr_palloc(p, 1);
+        em->ezweb->typeD[0] = 0;
+      }
+    }
+  }
+  return NULL;
+}
+
+static char*
+load_emoji_jphone_tag(
+  Doc* doc,
+  apr_pool_t* p,
+  emoji_t* em,
+  Node* node)
+{
+  Node* child;
+
+
+  em->jphone->string = NULL;
+
+  for (child = qs_get_child_node(doc, node);
+       child ;
+       child = qs_get_next_node(doc, child))
+  {
+    char* name  = qs_get_node_name(doc, child);
+    if (strcasecmp(name, "string") == 0) 
+    {
+      Node* stringnode = qs_get_child_node(doc, child);
+      if (stringnode != NULL)
+      {
+        char* cname = qs_get_node_name(doc, stringnode);
+        char* cvalue = qs_get_node_value(doc, stringnode);
+        if (strcasecmp(cname, "text") == 0)
+        {
+          int ii;
+          int jj;
+          char* tmp = apr_palloc(p, strlen(cvalue)+1);
+          memset(tmp, 0, strlen(cvalue)+1);
+
+          for (jj=0,ii=0; ii< strlen(cvalue); ii++) 
+          {
+            if (strncasecmp(&cvalue[ii] , ESCAPE_CHAR_LT, strlen(ESCAPE_CHAR_LT)) == 0)
+            {
+              tmp[jj] = '<';
+              jj++;
+              ii += (strlen(ESCAPE_CHAR_LT) - 1);
+            }
+            else
+            if (strncasecmp(&cvalue[ii] , ESCAPE_CHAR_GT, strlen(ESCAPE_CHAR_GT)) == 0)
+            {
+              tmp[jj] = '>';
+              jj++;
+              ii += (strlen(ESCAPE_CHAR_GT) - 1);
+            }
+            else
+            {
+              tmp[jj] = cvalue[ii];
+              jj++;
+            }
+          }
+          em->jphone->string = apr_pstrdup(p,tmp);
+        }
+      }
+      else
+      {
+        em->jphone->string    = apr_palloc(p, 1);
+        em->jphone->string[0] = 0;
+      }
+    }
+  }
+  return NULL;
+}
+
+static void
+emoji_add_to_tail(
+  mod_chxj_config* conf,
+  emoji_t* emoji)
+{
+  emoji->next = NULL;
+  if (conf->emoji == NULL)
+  {
+    conf->emoji      = emoji;
+    conf->emoji_tail = emoji;
+    return;
+  }
+
+  conf->emoji_tail->next = emoji;
+  conf->emoji_tail = emoji;
+}
+
+static char 
+hexstring_to_byte(char* s)
+{
+  int len;
+  int ii;
+  char one_byte = 0;
+
+  len = strlen(s);
+  for (ii=0; ii<len; ii++)
+  {
+    switch(s[ii]) 
+    {
+    case '1':
+    case '2':
+    case '3':
+    case '4':
+    case '5':
+    case '6':
+    case '7':
+    case '8':
+    case '9':
+    case '0':
+      one_byte |= (0xFF & (((s[ii] - '0') & 0xFF) << ((1-ii)*4)));
+      break;
+    case 'A':
+    case 'a':
+      one_byte |= (0xFF & ((0x0A & 0xFF) << ((1-ii)*4)));
+      break;
+    case 'B':
+    case 'b':
+      one_byte |= (0xFF & ((0x0B & 0xFF) << ((1-ii)*4)));
+      break;
+    case 'C':
+    case 'c':
+      one_byte |= (0xFF & ((0x0C & 0xFF) << ((1-ii)*4)));
+      break;
+    case 'D':
+    case 'd':
+      one_byte |= (0xFF & ((0x0d & 0xFF) << ((1-ii)*4)));
+      break;
+    case 'E':
+    case 'e':
+      one_byte |= (0xFF & ((0x0e & 0xFF) << ((1-ii)*4)));
+      break;
+    case 'F':
+    case 'f':
+      one_byte |= (0xFF & ((0x0f & 0xFF) << ((1-ii)*4)));
+      break;
+    default:
+      break;
+    }
+  }
+  return one_byte;
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_load_emoji_data.h b/src/chxj_load_emoji_data.h
new file mode 100644 (file)
index 0000000..2439bcd
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __LOAD_EMOJI_DATA_H__
+#define __LOAD_EMOJI_DATA_H__
+
+#define ESCAPE_CHAR_LT "&lt;"
+#define ESCAPE_CHAR_GT "&gt;"
+
+
+char* chxj_load_emoji_data( Doc* doc, apr_pool_t *p, mod_chxj_config* conf);
+
+#endif
diff --git a/src/chxj_specified_device.c b/src/chxj_specified_device.c
new file mode 100644 (file)
index 0000000..e0f44d7
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "mod_chxj.h"
+static device_table  UNKNOWN_DEVICE      = {
+    NULL, "","UNKNOWN", CHXJ_SPEC_UNKNOWN,  0,  0,0,0,0,0,0,0, ""};
+
+/**
+ * The device is specified from UserAgent. 
+ * @param r Request_rec is appointed.
+ * @param userAgent UserAgent is appointed here,
+ * @return The style which corresponds is returned.
+ */
+device_table*
+chxj_specified_device(request_rec* r, const char* user_agent) 
+{
+  regex_t *regexp;
+  regmatch_t match[10];
+  device_table *returnType = &UNKNOWN_DEVICE;
+  device_table_list* dtl;
+  device_table* dt;
+  mod_chxj_config* conf; 
+  int rtn;
+  char* device_id;
+
+  conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+  for (dtl = conf->devices; dtl; dtl = dtl->next) 
+  {
+    if (dtl->pattern == NULL)
+    {
+      continue;
+    }
+    regexp = ap_pregcomp(r->pool, (const char*)dtl->pattern, REG_EXTENDED|REG_ICASE);
+    if (regexp == NULL) 
+    {
+      return returnType;
+    }
+
+    rtn = ap_regexec(regexp, user_agent, regexp->re_nsub + 1, match, 0);
+    if (rtn == 0) 
+    {
+      device_id = ap_pregsub(r->pool, "$1", user_agent, regexp->re_nsub + 1, match);
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "device_id:[%s]", device_id);
+      for (dt = dtl->table; dt; dt = dt->next) 
+      {
+        if (strcasecmp(device_id, dt->device_id) == 0) 
+        {
+          ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "device_name:[%s]", dt->device_name);
+          returnType = dt;
+          break;
+        }
+      }
+      if (dt == NULL) 
+      {
+        for (dt = dtl->table; dt; dt = dt->next) 
+        {
+          if (dt->next == NULL) {
+            break;
+          }
+        }
+        if (dt != NULL)
+        {
+          returnType = dt;
+        }
+      }
+    }
+    ap_pregfree(r->pool, regexp);
+    if (returnType != &UNKNOWN_DEVICE) 
+    {
+      return returnType;
+    }
+  }
+
+  return returnType;
+}
+
+/*
+ * vim:ts=2 et
+ */
+
diff --git a/src/chxj_specified_device.h b/src/chxj_specified_device.h
new file mode 100644 (file)
index 0000000..8c4e015
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_SPECIFIED_DEVICE_H__
+#define __CHXJ_SPECIFIED_DEVICE_H__
+
+#define CHXJ_SPEC_UNKNOWN          (0x00)
+#define CHXJ_SPEC_Chtml_1_0        (0x11)
+#define CHXJ_SPEC_Chtml_2_0        (0x12)
+#define CHXJ_SPEC_Chtml_3_0        (0x13)
+#define CHXJ_SPEC_Chtml_4_0        (0x14)
+#define CHXJ_SPEC_Chtml_5_0        (0x15)
+#define CHXJ_SPEC_XHtml_Mobile_1_0 (0x20)
+#define CHXJ_SPEC_Hdml             (0x30)
+#define CHXJ_SPEC_Jhtml            (0x40)
+#define CHXJ_PIC_OK                (0x01)
+#define CHXJ_PIC_NG                (0x00)
+
+
+typedef struct device_table_t {
+  struct device_table_t* next;
+  const char* device_id;
+  const char* device_name;
+  int html_spec_type;
+  int width;
+  int heigh;
+  int available_gif;
+  int available_jpeg;
+  int available_png;
+  int available_bmp2;
+  int available_bmp4;
+  int color;
+  char* emoji_type;
+} device_table;
+
+typedef struct device_table_list_t {
+  struct device_table_list_t* next;
+  char* pattern;
+  device_table* table;
+  device_table* tail;
+} device_table_list;
+
+device_table* chxj_specified_device(request_rec* r, const char* user_agent);
+
+#endif
diff --git a/src/chxj_str_util.c b/src/chxj_str_util.c
new file mode 100644 (file)
index 0000000..e40fac9
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_str_util.h"
+
+int
+chxj_chk_numeric(const char* s)
+{
+  int len = strlen(s);
+  int ii;
+
+  for (ii=0; ii<len; ii++)
+  {
+    if (s[ii] < '0' || s[ii] > '9') 
+    {
+      return -1; /* NG */
+    }
+  }
+  return 0; /* OK */
+}
+
+int
+chxj_atoi(const char* s)
+{
+  int len = strlen(s);
+  int ii;
+  int result;
+
+  result = 0;
+  for (ii=0; ii < len; ii++) 
+  {
+    result *= 10;
+    switch(s[ii]) 
+    {
+    case '0': result += 0; break; 
+    case '1': result += 1; break;
+    case '2': result += 2; break;
+    case '3': result += 3; break;
+    case '4': result += 4; break;
+    case '5': result += 5; break;
+    case '6': result += 6; break;
+    case '7': result += 7; break;
+    case '8': result += 8; break;
+    case '9': result += 9; break;
+    default: break;
+    }
+  }
+  return result;
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_str_util.h b/src/chxj_str_util.h
new file mode 100644 (file)
index 0000000..17e6201
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_STR_UTIL_H__
+#define __CHXJ_STR_UTIL_H__
+
+#include <string.h>
+
+int chxj_chk_numeric(const char* s);
+int chxj_atoi(const char* s);
+
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_tag_util.c b/src/chxj_tag_util.c
new file mode 100644 (file)
index 0000000..1d9f06a
--- /dev/null
@@ -0,0 +1,553 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "chxj_tag_util.h"
+
+/**
+ * The value of the VALUE attribute that the object tag node maintains is
+ * acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure to be scanned is
+ *                 specified.
+ * @param node [i] The tag node to be scanned is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the VALUE attribute that the object tag node maintains
+ *         is returned. NULL is returned when not found.
+ */
+char*
+qs_get_value_attr(Doc* doc, Node* node, request_rec* r)
+{
+  Attr*        attr;
+
+  /*--------------------------------------------------------------------------*/
+  /* The object tag node is scanned.                                          */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr != NULL;
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "value") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* The VALUE attribute was found.                                       */
+      /*----------------------------------------------------------------------*/
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+  /*--------------------------------------------------------------------------*/
+  /* not found                                                                */
+  /*--------------------------------------------------------------------------*/
+  return NULL;
+}
+
+/**
+ * The value of the checked tag is acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure to be scanned is
+ *                 specified.
+ * @param tag  [i] The tag node to be scanned is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the checked tag is returned. NULL is returned when
+ *         not found.
+ */
+char*
+qs_get_checked_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr*        attr;
+  int          found_flag = 0;
+
+  /*--------------------------------------------------------------------------*/
+  /* The object tag node is scanned.                                          */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,tag);
+       attr != NULL;
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    if (strcasecmp(name, "checked") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* The VALUE attribute was found.                                       */
+      /*----------------------------------------------------------------------*/
+      found_flag = 1;
+      break;
+    }
+  }
+  if (found_flag == 0)
+  {
+    /*------------------------------------------------------------------------*/
+    /* not found                                                              */
+    /*------------------------------------------------------------------------*/
+    return NULL;
+  }
+  return qs_get_value_attr(doc, tag, r);
+}
+/**
+ * The value of the type attribute is acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure to be scanned is
+ *                 specified.
+ * @param tag  [i] The tag node to be scanned is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the type attribute is returned. NULL is returned when
+ *         not found.
+ */
+char*
+qs_get_type_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr*        attr;
+
+  /*--------------------------------------------------------------------------*/
+  /* The object tag node is scanned.                                          */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,tag);
+       attr != NULL;
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "type") == 0)
+    {
+      /*----------------------------------------------------------------------*/
+      /* The VALUE attribute was found.                                       */
+      /*----------------------------------------------------------------------*/
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+  /*--------------------------------------------------------------------------*/
+  /* not found                                                                */
+  /*--------------------------------------------------------------------------*/
+  return NULL;
+}
+
+/**
+ * The character string area in 0 bytes is allocated.
+ *
+ * @param r    [i]   To use POOL, the pointer to request_rec is specified.
+ * @return The allocated 0 byte character string is returned.
+ */
+char*
+qs_alloc_zero_byte_string(request_rec* r)
+{
+  char* tgt = apr_palloc(r->pool, 1);
+  tgt[0] = '\0';
+
+  return tgt;
+}
+
+/**
+ * A consecutive head and the last WHITESPACE are removed.
+ *
+ * @param r    [i]   To use POOL, the pointer to request_rec is specified.
+ * @param s    [i]   The character string that should be removed is specified.
+ * @return The character string that has been removed is returned.
+ */
+char*
+qs_trim_string(request_rec* r, char* s)
+{
+  char* ss = apr_pstrdup(r->pool, s);
+  int len = strlen(s);
+  int ii;
+
+  ii = 0;
+  for (ii = 0;is_white_space(*ss) && ii < len; ss++, ii++);
+
+  ii = strlen(ss);
+  for(;is_white_space(ss[ii-1]) && ii > 0; ii--);
+
+  ss[ii] = '\0';
+
+  return ss;
+}
+
+/**
+ * The value of child TEXT of tag that maintains the SELECTED attribute is 
+ * returned. 
+ *
+ * @param Doc  [i] The pointer to the Doc structure to be scanned is 
+ *                 specified. 
+ * @param node [i] The tag node to be scanned is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @reutrn  The value of child TEXT of tag that maintains the SELECTED 
+ *          attribute is returned. NULL is returned when not found. 
+ */
+char*
+qs_get_selected_value_text(Doc *doc, Node* node, request_rec* r)
+{
+  Node* child;
+  Node* selchild;
+  char* result   = NULL;
+
+  for (child = qs_get_child_node(doc,node);
+       child != NULL; 
+       child = qs_get_next_node(doc,child))
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <OPTION> tag                                                           */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "option") == 0) 
+    {
+      Attr* attr;
+      for (attr =  qs_get_attr(doc,child); 
+           attr != NULL; 
+           attr = qs_get_next_attr(doc,attr)) 
+      {
+        char* name  = qs_get_attr_name(doc,attr);
+
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                        "qs_get_selected_value name::[%s]" , name);
+        if (strcasecmp(name, "selected") == 0) 
+        {
+          /*------------------------------------------------------------------*/
+          /* SELECTED Value Found                                             */
+          /*------------------------------------------------------------------*/
+          selchild = qs_get_child_node(doc, child);
+          if (selchild == NULL) 
+          {
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                            "found selected tag but null node" );
+            return NULL;
+          }
+          return qs_get_node_value(doc, selchild);
+        }
+      }
+    }
+    result = qs_get_selected_value_text(doc, child, r);
+    if (result != NULL)
+    {
+      return result;
+    }
+  }
+
+  /*--------------------------------------------------------------------------*/
+  /* not found                                                                */
+  /*--------------------------------------------------------------------------*/
+  return NULL;
+}
+
+/**
+ * The value of tag that maintains the SELECTED attribute is acquired. 
+ *
+ * @param doc    [i]  The pointer to the Doc structure to be scanned is 
+ *                    specified. 
+ * @param node   [i]  The SELECT tag node is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of tag that maintains the SELECTED attribute is 
+ *         returned. NULL is returned when not found. 
+ */
+char*
+qs_get_selected_value(Doc* doc, Node* node, request_rec* r)
+{
+  Node*         child;
+  char*         result    = NULL;
+
+  for (child = qs_get_child_node(doc,node); 
+       child != NULL; 
+       child = qs_get_next_node(doc,child))
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <OPTION> tag                                                           */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "option") == 0) 
+    {
+      Attr* attr;
+      for (attr = qs_get_attr(doc,child); 
+           attr != NULL; 
+           attr = qs_get_next_attr(doc,attr)) 
+      {
+        char* name  = qs_get_attr_name(doc,attr);
+
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                        "qs_get_selected_value name::[%s]" , name);
+        if (strcasecmp(name, "selected") == 0) 
+        {
+          /*------------------------------------------------------------------*/
+          /* SELECTED Value Found                                             */
+          /*------------------------------------------------------------------*/
+          return qs_get_value_attr(doc, child, r);
+        }
+      }
+    }
+    result = qs_get_selected_value(doc, child, r);
+    if (result != NULL)
+    {
+      return result;
+    }
+  }
+
+  /*--------------------------------------------------------------------------*/
+  /* not found                                                                */
+  /*--------------------------------------------------------------------------*/
+  return NULL;
+}
+
+/**
+ * The value of the SIZE attribute is acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure at the output
+ *                 destination is specified.
+ * @param tag  [i] The tag node to want to acquire the SIZE attribute
+ *                 is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the SIZE attribute is returned. NULL is
+ *         returned when not is.
+ */
+char*
+qs_get_name_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr* attr;
+
+  for (attr = qs_get_attr(doc,tag); attr != NULL; attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "name") == 0)
+    {
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+
+  return NULL;
+}
+
+/**
+ * The value of the SIZE attribute is acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure at the output
+ *                 destination is specified.
+ * @param tag  [i] The tag node to want to acquire the SIZE attribute
+ *                 is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the SIZE attribute is returned. NULL is
+ *         returned when not is.
+ */
+char*
+qs_get_size_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr* attr;
+
+  for (attr = qs_get_attr(doc,tag); attr != NULL; attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "size") == 0)
+    {
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+
+  return NULL;
+}
+
+/**
+ * The value of the ACCESSKEY attribute is acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure at the output
+ *                 destination is specified.
+ * @param tag  [i] The tag node to want to acquire the ACCESSKEY attribute
+ *                 is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the ACCESSKEY attribute is returned. NULL is
+ *         returned when not is.
+ */
+char*
+qs_get_accesskey_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr* attr;
+
+  for (attr = qs_get_attr(doc,tag); attr != NULL; attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "accesskey") == 0)
+    {
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+
+  return NULL;
+}
+
+/**
+ * The value of the ISTYLE attribute is acquired.
+ *
+ * @param doc  [i] The pointer to the Doc structure at the output
+ *                 destination is specified.
+ * @param tag  [i] The tag node to want to acquire the ISTYLE attribute
+ *                 is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the ISTYLE attribute is returned. NULL is
+ *         returned when not is.
+ */
+char*
+qs_get_istyle_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr*        attr;
+
+  for (attr = qs_get_attr(doc,tag); 
+       attr != NULL; 
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "istyle") == 0)
+    {
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+
+  return NULL;
+}
+
+/**
+ * The value of the MAXLENGTH attribute is acquired from the tag node of the
+ * object.
+ *
+ * @param doc  [i] The pointer to the Doc structure at the output
+ *                 destination is specified.
+ * @param tag  [i] The tag node to want to acquire the MAXLENGTH attribute
+ *                 is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return The value of the MAXLENGTH attribute is returned. NULL is
+ *         returned when not is.
+ */
+char*
+qs_get_maxlength_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr*        attr;
+
+  for (attr = qs_get_attr(doc,tag);
+       attr != NULL; 
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "maxlength") == 0)
+    {
+      return apr_pstrdup(r->pool, value);
+    }
+  }
+  return NULL;
+}
+
+/**
+ * It is scanned whether the CHECKBOX tag of the object is CHECKED. 
+ *
+ * @param doc  [i] The pointer to the Doc structure at the output
+ *                 destination is specified.
+ * @param tag  [i] The tag node to want to acquire the CHECKBOX attribute
+ *                 is specified.
+ * @param r    [i] To use POOL, the pointer to request_rec is specified.
+ * @return 1 is returned when it is CHECKED and, additionally, 0 is returned. 
+ */
+int
+qs_is_checked_checkbox_attr(Doc* doc, Node* tag, request_rec* r)
+{
+  Attr* attr;
+
+  for (attr = qs_get_attr(doc,tag);
+       attr != NULL; 
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+
+    if (strcasecmp(name, "checked") == 0)
+    {
+      return 1;
+    }
+  }
+  return 0;
+}
+
+
+int
+chxj_chxjif_is_mine(device_table* spec, Doc* doc, Node* tag)
+{
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  for (attr = qs_get_attr(doc,tag);
+       attr != NULL; 
+       attr = qs_get_next_attr(doc,attr))
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "lang") == 0)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "lang found [%s] spec [%d]", value, spec->html_spec_type);
+      if (strcasecmp(value, "xhtml") == 0) 
+      {
+        if (spec->html_spec_type == CHXJ_SPEC_XHtml_Mobile_1_0)
+        {
+          /* Yes , it is mine */
+          return 1;
+        }
+      }
+      else
+      if (strcasecmp(value, "hdml") == 0)
+      {
+        if (spec->html_spec_type == CHXJ_SPEC_Hdml)
+        {
+          /* Yes , it is mine */
+          return 1;
+        }
+      }
+      else
+      if (strcasecmp(value, "jhtml") == 0)
+      {
+        if (spec->html_spec_type == CHXJ_SPEC_Jhtml)
+        {
+          /* Yes , it is mine */
+          return 1;
+        }
+      }
+      else
+      if (strcasecmp(value, "chtml") == 0)
+      {
+        switch (spec->html_spec_type) {
+        case CHXJ_SPEC_Chtml_1_0:
+        case CHXJ_SPEC_Chtml_2_0:
+        case CHXJ_SPEC_Chtml_3_0:
+        case CHXJ_SPEC_Chtml_4_0:
+        case CHXJ_SPEC_Chtml_5_0:
+          return 1;
+        default:
+          break;
+        }
+      }
+    }
+  }
+
+  /* No, it is not mine. */
+  return 0;
+}
+
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_tag_util.h b/src/chxj_tag_util.h
new file mode 100644 (file)
index 0000000..16edd74
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_TAG_UTIL_H__
+#define __CHXJ_TAG_UTIL_H__
+
+#include "mod_chxj.h"
+
+/*----------------------------------------------------------------------------*/
+/* prototype declare                                                          */
+/*----------------------------------------------------------------------------*/
+char*    qs_get_value_attr     (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_checked_attr   (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_type_attr      (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_name_attr      (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_istyle_attr    (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_maxlength_attr (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_size_attr      (Doc* doc, Node* tag, request_rec* r);
+char*    qs_get_accesskey_attr (Doc* doc, Node* tag, request_rec* r);
+
+int      qs_is_checked_checkbox_attr(Doc* doc, Node* tag, request_rec* r);
+
+char*    qs_get_selected_value_text(Doc *doc, Node* node, request_rec* r);
+char*    qs_get_selected_value(Doc* doc, Node* node, request_rec* r);
+
+char*    qs_alloc_zero_byte_string(request_rec* r);
+char*    qs_trim_string(request_rec* r, char* s);
+
+int chxj_chxjif_is_mine(device_table* spec, Doc* doc, Node* tag);
+
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_xhtml_mobile_1_0.c b/src/chxj_xhtml_mobile_1_0.c
new file mode 100644 (file)
index 0000000..58229dd
--- /dev/null
@@ -0,0 +1,1801 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "mod_chxj.h"
+#include "chxj_xhtml_mobile_1_0.h"
+#include "chxj_hdml.h"
+#include "chxj_dump.h"
+#include "chxj_img_conv.h"
+
+
+static char* xhtml_1_0_node_exchange    (Xhtml* xhtml, Node* node, int indent);
+static char* xhtml_1_0_start_html_tag   (Xhtml* xhtml, Node* child);
+static char* xhtml_1_0_end_html_tag     (Xhtml* xhtml, Node* child);
+static char* xhtml_1_0_start_meta_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_meta_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_head_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_head_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_title_tag  (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_title_tag    (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_base_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_base_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_body_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_body_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_a_tag      (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_a_tag        (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_br_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_br_tag       (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_font_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_font_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_form_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_form_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_input_tag  (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_input_tag    (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_center_tag (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_center_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_hr_tag     (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_hr_tag       (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_img_tag    (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_img_tag      (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_select_tag (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_select_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_option_tag (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_option_tag   (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_start_div_tag    (Xhtml* xhtml, Node* node);
+static char* xhtml_1_0_end_div_tag      (Xhtml* xhtml, Node* node);
+static void chxj_init_xhtml(Xhtml* xhtml, Doc* doc, request_rec* r, device_table* spec);
+static int xhtml_search_emoji(Xhtml* xhtml, char* txt, char** rslt);
+static void xhtml_1_0_chxjif_tag(Xhtml* xhtml, Node* node);
+/**
+ * converts from CHTML to XHTML.
+ *
+ * @param r     [i]   Requet_rec is appointed.
+ * @param spec  [i]   The result of the device specification processing which 
+ *                    was done in advance is appointed.
+ * @param src   [i]   The character string before the converting is appointed.
+ * @return The character string after the converting is returned.
+ */
+char*
+chxj_exchange_xhtml_mobile_1_0(
+  request_rec* r,
+  device_table *spec,
+  const char* src,
+  apr_size_t srclen,
+  apr_size_t *dstlen)
+{
+  char*     dst = NULL;
+  char*     ss;
+  Xhtml     xhtml;
+  Doc       doc;
+
+  /*--------------------------------------------------------------------------*/
+  /* The XHTML structure is initialized.                                      */
+  /*--------------------------------------------------------------------------*/
+  chxj_init_xhtml(&xhtml, &doc, r, spec);
+
+  /*--------------------------------------------------------------------------*/
+  /* The character string of the input is analyzed.                           */
+  /*--------------------------------------------------------------------------*/
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  ss = apr_pcalloc(r->pool, srclen + 1);
+  memset(ss, 0, srclen + 1);
+  memcpy(ss, src, srclen);
+
+#ifdef DUMP_LOG
+  chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
+#endif
+  qs_parse_string(&doc,ss);
+
+  /*--------------------------------------------------------------------------*/
+  /* It converts it from CHTML to XHTML.                                      */
+  /*--------------------------------------------------------------------------*/
+  dst = xhtml_1_0_node_exchange(&xhtml, qs_get_root(&doc), 0);
+  qs_all_free(&doc,QX_LOGMARK);
+
+  if (dst == NULL) 
+  {
+    return apr_pstrdup(r->pool,ss);
+  }
+
+  if (strlen(dst) == 0)
+  {
+    dst = apr_psprintf(r->pool, "\n");
+  }
+  *dstlen = strlen(dst);
+#ifdef DUMP_LOG
+  chxj_dump_out("[dst] CHTML->XHTML", dst, *dstlen);
+#endif
+  return dst;
+}
+
+/**
+ * The XHTML structure is initialized.
+ *
+ * @param xhtml [i/o] The pointer to the HDML structure that wants to be
+ *                   initialized is specified.
+ * @param doc   [i]   The Doc structure that should be set to the initialized
+ *                   HDML structure is specified.
+ * @param r     [i]   To use POOL, the pointer to request_rec is specified.
+ * @param spec  [i]   The pointer to the device_table
+ */
+static void
+chxj_init_xhtml(Xhtml* xhtml, Doc* doc, request_rec* r, device_table* spec)
+{
+  memset(doc,   0, sizeof(Doc));
+  memset(xhtml, 0, sizeof(Xhtml));
+
+  doc->r      = r;
+  xhtml->doc  = doc;
+  xhtml->spec = spec;
+  xhtml->out  = qs_alloc_zero_byte_string(r);
+  xhtml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+}
+
+/**
+ * It is main processing of conversion from CHTML to XHTML. 
+ *
+ * @param xhtml   [i/o] The pointer to the XHTML structure is specified. 
+ * @param node    [i]   The pointer to a current node is specified. 
+ * @param indent  [i]   The depth of the node processing it now is specified. 
+ *
+ * @return The character string after it converts it is returned. 
+ */
+static char*
+xhtml_1_0_node_exchange(Xhtml* xhtml, Node* node, int indent) 
+{
+  Node*         child;
+  Doc*          doc   = xhtml->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* It is the main loop of the conversion processing.                        */
+  /*--------------------------------------------------------------------------*/
+  for (child = qs_get_child_node(doc,node);
+       child ;
+       child = qs_get_next_node(doc,child)) 
+  {
+    char* name = qs_get_node_name(doc,child);
+
+    /*------------------------------------------------------------------------*/
+    /* <HTML>                                                                 */
+    /*------------------------------------------------------------------------*/
+    if (strcasecmp(name, "html") == 0) 
+    {
+      xhtml_1_0_start_html_tag(xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_html_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <META>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "meta") == 0) 
+    {
+      xhtml_1_0_start_meta_tag(xhtml, child);
+      xhtml_1_0_end_meta_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HEAD>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "head") == 0) 
+    {
+      xhtml_1_0_start_head_tag(xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_head_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <TITLE>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "title") == 0) 
+    {
+      xhtml_1_0_start_title_tag (xhtml, child);
+      xhtml_1_0_node_exchange   (xhtml, child,indent+1);
+      xhtml_1_0_end_title_tag   (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BASE>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "base") == 0) 
+    {
+      xhtml_1_0_start_base_tag(xhtml, child);
+      xhtml_1_0_end_base_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BODY>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "body") == 0) 
+    {
+      xhtml_1_0_start_body_tag(xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_body_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <A>                                                                    */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "a") == 0) 
+    {
+      xhtml_1_0_start_a_tag   (xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_a_tag     (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <BR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "br") == 0) 
+    {
+      xhtml_1_0_start_br_tag  (xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_br_tag    (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FONT>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "font") == 0) 
+    {
+      xhtml_1_0_start_font_tag(xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_font_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <FORM>                                                                 */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "form") == 0) 
+    {
+      xhtml_1_0_start_form_tag(xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child,indent+1);
+      xhtml_1_0_end_form_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <INPUT>                                                                */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "input") == 0) 
+    {
+      xhtml_1_0_start_input_tag (xhtml, child);
+      xhtml_1_0_node_exchange   (xhtml, child,indent+1);
+      xhtml_1_0_end_input_tag   (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <HR>                                                                   */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "hr") == 0) 
+    {
+      xhtml_1_0_start_hr_tag  (xhtml, child);
+      xhtml_1_0_end_hr_tag    (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CENTER>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "center") == 0) 
+    {
+      xhtml_1_0_start_center_tag(xhtml, child);
+      xhtml_1_0_node_exchange   (xhtml, child,indent+1);
+      xhtml_1_0_end_center_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <IMG>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "img") == 0) 
+    {
+      xhtml_1_0_start_img_tag (xhtml, child);
+      xhtml_1_0_end_img_tag   (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <SELECT>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "select") == 0)
+    {
+      xhtml_1_0_start_select_tag(xhtml, child);
+      xhtml_1_0_node_exchange   (xhtml, child, indent+1);
+      xhtml_1_0_end_select_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <OPTION>                                                               */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "option") == 0)
+    {
+      xhtml_1_0_start_option_tag(xhtml, child);
+      xhtml_1_0_node_exchange   (xhtml, child, indent+1);
+      xhtml_1_0_end_option_tag  (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <DIV>                                                                  */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "div") == 0)
+    {
+      xhtml_1_0_start_div_tag (xhtml, child);
+      xhtml_1_0_node_exchange (xhtml, child, indent+1);
+      xhtml_1_0_end_div_tag   (xhtml, child);
+    }
+    /*------------------------------------------------------------------------*/
+    /* <CHXJ:IF>                                                              */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "chxj:if") == 0)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
+      if (chxj_chxjif_is_mine(xhtml->spec, doc, child))
+      {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
+        xhtml_1_0_chxjif_tag(xhtml, child);
+      }
+    }
+    /*------------------------------------------------------------------------*/
+    /* NORMAL TEXT                                                            */
+    /*------------------------------------------------------------------------*/
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      char*   textval;
+      char*   tmp;
+      char*   tdst;
+      char    one_byte[2];
+      int     ii;
+      int     tdst_len;
+
+      textval = qs_get_node_value(doc,child);
+      textval = qs_trim_string(xhtml->doc->r, textval);
+      if (strlen(textval) == 0)
+      {
+        continue;
+      }
+
+      tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
+      memset(tmp, 0, qs_get_node_size(doc,child)+1);
+
+      tdst     = qs_alloc_zero_byte_string(r);
+      memset(one_byte, 0, sizeof(one_byte));
+      tdst_len = 0;
+
+      for (ii=0; ii<qs_get_node_size(doc,child); ii++)
+      {
+        char* out;
+        int rtn = xhtml_search_emoji(xhtml, &textval[ii], &out);
+        if (rtn != 0)
+        {
+          ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0, r,
+                          "[%s][%d]", out, rtn);
+          tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
+          ii+=(rtn - 1);
+          continue;
+        }
+        if (is_sjis_kanji(textval[ii]))
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          one_byte[0] = textval[ii+1];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+          ii++;
+        }
+        else if (textval[ii] != '\r' && textval[ii] != '\n')
+        {
+          one_byte[0] = textval[ii+0];
+          tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
+        }
+      }
+      xhtml->out = apr_pstrcat(r->pool, xhtml->out, tdst, NULL);
+    }
+  }
+  return xhtml->out;
+}
+
+/**
+ * Corresponding EMOJI to a current character-code is retrieved. 
+ * The substitution character string is stored in the rslt pointer if agreeing.
+ *
+ * @param xhtml   [i]   The pointer to the XHTML structure is specified. 
+ * @param txt     [i]   The character string to want to examine whether it is 
+ *                      EMOJI is specified. 
+ * @param rslt    [o]   The pointer to the pointer that stores the result is 
+ *                      specified. 
+ * @return When corresponding EMOJI exists, it returns it excluding 0. 
+ */
+static int
+xhtml_search_emoji(Xhtml* xhtml, char* txt, char** rslt)
+{
+  emoji_t*      ee;
+  request_rec*  r;
+  device_table* spec;
+  int           len;
+
+  spec = xhtml->spec;
+
+  len = strlen(txt);
+  r = xhtml->doc->r;
+
+  if (spec == NULL)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
+  }
+
+  for (ee = xhtml->conf->emoji;
+       ee;
+       ee = ee->next) 
+  {
+    unsigned char hex1byte;
+    unsigned char hex2byte;
+    if (ee->imode == NULL)
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                      "emoji->imode is NULL");
+      continue;
+    }
+
+    if (ee->imode->string != NULL
+    &&  strlen(ee->imode->string) > 0
+    &&  strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=%s>",
+                        ee->ezweb->typeA);
+        return strlen(ee->imode->string);
+      }
+
+      if (strcasecmp(xhtml->spec->emoji_type, "a") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=%s>",
+                        ee->ezweb->typeA);
+        return strlen(ee->imode->string);
+      } 
+      else
+      if (strcasecmp(xhtml->spec->emoji_type, "b") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=%s>",
+                        ee->ezweb->typeB);
+        return strlen(ee->imode->string);
+      }
+      else
+      if (strcasecmp(xhtml->spec->emoji_type, "c") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=%s>",
+                        ee->ezweb->typeC);
+        return strlen(ee->imode->string);
+      }
+      else
+      if (strcasecmp(xhtml->spec->emoji_type, "d") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=%s>",
+                        ee->ezweb->typeD);
+        return strlen(ee->imode->string);
+      }
+      else
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=%s>",
+                        ee->ezweb->typeA);
+        return strlen(ee->imode->string);
+      }
+      return 0;
+    }
+    hex1byte = ee->imode->hex1byte & 0xff;
+    hex2byte = ee->imode->hex2byte & 0xff;
+    if (len >= 2
+    && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
+    && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) 
+    {
+      if (spec == NULL || spec->emoji_type == NULL)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=\"%s\">",
+                        ee->ezweb->typeA);
+        return 2;
+      }
+
+      if (strcasecmp(xhtml->spec->emoji_type, "a") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=\"%s\">",
+                        ee->ezweb->typeA);
+        return 2;
+      } 
+      else
+      if (strcasecmp(xhtml->spec->emoji_type, "b") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=\"%s\">",
+                        ee->ezweb->typeB);
+        return 2;
+      }
+      else
+      if (strcasecmp(xhtml->spec->emoji_type, "c") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=\"%s\">",
+                        ee->ezweb->typeC);
+        return 2;
+      }
+      else
+      if (strcasecmp(xhtml->spec->emoji_type, "d") == 0)
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=\"%s\">",
+                        ee->ezweb->typeD);
+        return 2;
+      }
+      else
+      {
+        *rslt = apr_psprintf(r->pool,
+                        "<img localsrc=\"%s\">",
+                        ee->ezweb->typeD);
+        return 2;
+      }
+      return 0;
+    }
+  }
+  return 0;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_html_tag(Xhtml* xhtml, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = xhtml->doc;
+  request_rec*  r     = doc->r;
+
+  /*--------------------------------------------------------------------------*/
+  /* Add XML Declare                                                          */
+  /*--------------------------------------------------------------------------*/
+  xhtml->out = apr_pstrcat(r->pool, 
+    xhtml->out, 
+    "<?xml version=\"1.0\" encoding=\"Windows-31J\"?>\r\n", 
+    NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Add DocType                                                              */
+  /*--------------------------------------------------------------------------*/
+  xhtml->out = apr_pstrcat(r->pool, 
+          xhtml->out, 
+          "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"\r\n",NULL);
+  xhtml->out = apr_pstrcat(r->pool, 
+          xhtml->out, 
+          " \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">\r\n",NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* start HTML tag                                                           */
+  /*--------------------------------------------------------------------------*/
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<html", NULL);
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, 
+          " xmlns=\"http://www.w3.org/1999/xhtml\"", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "lang") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " xml:lang=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "version") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"", 
+                      NULL);
+    }
+  }
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">\r\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the HTML tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HTML tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_html_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</html>\r\n", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_meta_tag(Xhtml* xhtml, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = xhtml->doc;
+  request_rec*  r     = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<meta", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "name") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool,
+                      xhtml->out,
+                      " ", 
+                      name, 
+                      "=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "http-equiv") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool,
+                      xhtml->out,
+                      " ", 
+                      name,
+                      "=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "content") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool,
+                      xhtml->out, 
+                      " ", 
+                      name, 
+                      "=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+  }
+
+  xhtml->out = apr_pstrcat(r->pool, 
+                  xhtml->out, 
+                  " />\r\n", 
+                  NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the META tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The META tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_meta_tag(Xhtml* xhtml, Node* child) 
+{
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_head_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<head>\r\n", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the HEAD tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HEAD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_head_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</head>\r\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_title_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<title>", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the TITLE tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TITLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_title_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</title>\r\n", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_base_tag(Xhtml* xhtml, Node* node) 
+{
+  Attr*         attr;
+  Doc*          doc   = xhtml->doc;
+  request_rec*  r     = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<base", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "href") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+  }
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, " />\r\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the BASE tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BASE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_base_tag(Xhtml* xhtml, Node* child) 
+{
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_body_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<body", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "bgcolor") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " bgcolor=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "text") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " text=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "link") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " link=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "alink") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "vlink") == 0) 
+    {
+      /* ignore */
+    }
+  }
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">\r\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the BODY tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BODY tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_body_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</body>\r\n", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_a_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc*          doc   = xhtml->doc;
+  request_rec*  r     = doc->r;
+  Attr*         attr;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<a", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr; 
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "name") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " id=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "href") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " href=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "accesskey") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " accesskey=\"", 
+                      value, 
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "cti") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ijam") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "telbook") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "kana") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "email") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ista") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "ilet") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "iswf") == 0) 
+    {
+      /* ignore */
+    }
+    else
+    if (strcasecmp(name, "irst") == 0) 
+    {
+      /* ignore */
+    }
+  }
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the A tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The A tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_a_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</a>", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_br_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<br />\r\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the BR tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The BR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_br_tag(Xhtml* xhtml, Node* child) 
+{
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_font_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<font", NULL);
+  /* Get Attributes */
+  for (attr = qs_get_attr(doc,node);
+       attr; attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "color") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, xhtml->out, " color=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "size") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, xhtml->out, " size=\"",value,"\"", NULL);
+    }
+  }
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the FONT tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FONT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_font_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</font>", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_form_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<form", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+    if (strcasecmp(name, "action") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " action=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "method") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " method=\"",
+                      value,
+                      "\"", 
+                      NULL);
+    }
+    else
+    if (strcasecmp(name, "utn") == 0) 
+    {
+      /* ignore */
+    }
+  }
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the FORM tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The FORM tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_form_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</form>", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_input_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc*          doc         = xhtml->doc;
+  request_rec*  r           = doc->r;
+  char*         max_length  = NULL;
+  char*         type        = NULL;
+  char*         name        = NULL;
+  char*         value       = NULL;
+  char*         istyle      = NULL;
+  char*         size        = NULL;
+  char*         checked     = NULL;
+  char*         accesskey   = NULL;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<input", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+
+  type       = qs_get_type_attr(doc, node, r);
+  name       = qs_get_name_attr(doc, node, r);
+  value      = qs_get_value_attr(doc,node,r);
+  istyle     = qs_get_istyle_attr(doc,node,r);
+  max_length = qs_get_maxlength_attr(doc,node,r);
+  checked    = qs_get_checked_attr(doc,node,r);
+  accesskey  = qs_get_accesskey_attr(doc, node, r);
+  size       = qs_get_size_attr(doc, node, r);
+
+  if (type != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool,
+                    xhtml->out, 
+                    " type=\"", 
+                    type, 
+                    "\" ", 
+                    NULL);
+  }
+  if (size != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, 
+                    xhtml->out, 
+                    " size=\"", 
+                    size, 
+                    "\" ", 
+                    NULL);
+  }
+  if (name != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, 
+                    xhtml->out, 
+                    " name=\"", 
+                    name, 
+                    "\" ", 
+                    NULL);
+  }
+  if (value != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, 
+                    xhtml->out, 
+                    " value=\"", 
+                    value, 
+                    "\" ", 
+                    NULL);
+  }
+  if (accesskey != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, 
+                    xhtml->out, 
+                    " accesskey=\"", 
+                    accesskey, "\" ", 
+                    NULL);
+  }
+  if (istyle != NULL)
+  {
+    char* fmt = qs_conv_istyle_to_format(r,istyle);
+    if (max_length != NULL)
+    {
+      int ii;
+      for (ii=0; ii<strlen(max_length); ii++)
+      {
+        if (max_length[ii] < '0' || max_length[ii] > '9')
+        {
+          max_length = apr_psprintf(r->pool, "0");
+          break;
+        }
+      }
+
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      apr_psprintf(r->pool, " FORMAT=\"%d%s\"", 
+                      atoi(max_length), 
+                      fmt), 
+                      NULL);
+    }
+    else
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " FORMAT=\"", 
+                      "*", 
+                      fmt, 
+                      "\"", 
+                      NULL);
+    }
+  }
+  /*--------------------------------------------------------------------------*/
+  /* The figure is default for the password.                                  */
+  /*--------------------------------------------------------------------------*/
+  if (type != NULL && istyle == NULL && strcasecmp(type, "password") == 0)
+  {
+    if (max_length != NULL)
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " FORMAT=\"", 
+                      max_length, 
+                      "N", 
+                      "\"", 
+                      NULL);
+    }
+    else
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, 
+                      " FORMAT=\"", "*", "N", "\"", NULL);
+    }
+  }
+  if (checked != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, 
+                    xhtml->out, " checked=\"checked\"", NULL);
+  }
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, " />", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the INPUT tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The INPUT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_input_tag(Xhtml* xhtml, Node* child) 
+{
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_center_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<center>", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_center_tag(Xhtml* xhtml, Node* child) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</center>", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_hr_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<hr />", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the HR tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The HR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_hr_tag(Xhtml* xhtml, Node* child) 
+{
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_img_tag(Xhtml* xhtml, Node* node) 
+{
+  Doc*          doc = xhtml->doc;
+  request_rec*  r   = doc->r;
+  Attr* attr;
+
+#ifndef IMG_NOT_CONVERT_FILENAME
+  device_table* spec = xhtml->spec;
+#endif
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<img", NULL);
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* name  = qs_get_attr_name(doc,attr);
+    char* value = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(name, "src") == 0) 
+    {
+#ifdef IMG_NOT_CONVERT_FILENAME
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " src=\"",value,"\"", NULL);
+#else
+      xhtml->out = apr_pstrcat(r->pool, xhtml->out,
+                      " src=\"", chxj_img_conv(r,spec,value) , NULL);
+      xhtml->out = apr_pstrcat(r->pool, xhtml->out, "\"", NULL);
+#endif
+    }
+    else
+    if (strcasecmp(name, "align" ) == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " align=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "width" ) == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " width=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "height") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " height=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "hspace") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " hspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "vspace") == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " vspace=\"",value,"\"", NULL);
+    }
+    else
+    if (strcasecmp(name, "alt"   ) == 0) 
+    {
+      xhtml->out = apr_pstrcat(r->pool, 
+                      xhtml->out, " alt=\"",value,"\"", NULL);
+    }
+  }
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the IMG tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The IMG tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_img_tag(Xhtml* xhtml, Node* child) 
+{
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_select_tag(Xhtml* xhtml, Node* child)
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* size      = NULL;
+  char* name      = NULL;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<select", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "size") == 0)
+    {
+      /* CHTML version 2.0 */
+      size = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "name") == 0)
+    {
+      /* CHTML version 2.0 */
+      name = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "multiple") == 0)
+    {
+      /* CHTML version 2.0 */
+      /* Ignore */
+    }
+  }
+
+  if (size != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, xhtml->out, " size=\"",size,"\"", NULL);
+  }
+  if (name != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, xhtml->out, " name=\"",name,"\"", NULL);
+  }
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the SELECT tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SELECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_select_tag(Xhtml* xhtml, Node* child)
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</select>\n", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_option_tag(Xhtml* xhtml, Node* child)
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* selected   = NULL;
+  char* value      = NULL;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<option", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "selected") == 0)
+    {
+      /* CHTML version 2.0 */
+      selected = apr_pstrdup(r->pool, val);
+    }
+    else
+    if (strcasecmp(nm, "value") == 0)
+    {
+      /* CHTML version 2.0 */
+      value = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (value != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, xhtml->out, " value=\"",value,"\"", NULL);
+  }
+  else
+  {
+    xhtml->out = apr_pstrcat(r->pool, xhtml->out, " value=\"\"", NULL);
+  }
+
+  if (selected != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, xhtml->out, " selected=\"selected\"", NULL);
+  }
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the OPTION tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OPTION tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_option_tag(Xhtml* xhtml, Node* child)
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</option>\n", NULL);
+
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_start_div_tag(Xhtml* xhtml, Node* child)
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+  Attr* attr;
+
+  char* align   = NULL;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "<div", NULL);
+  for (attr = qs_get_attr(doc,child);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) 
+  {
+    char* nm  = qs_get_attr_name(doc,attr);
+    char* val = qs_get_attr_value(doc,attr);
+
+    if (strcasecmp(nm, "align") == 0)
+    {
+      /* CHTML version 3.2 */
+      align = apr_pstrdup(r->pool, val);
+    }
+  }
+
+  if (align != NULL)
+  {
+    xhtml->out = apr_pstrcat(r->pool, 
+                    xhtml->out, " align=\"", align, "\"", NULL);
+  }
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, ">", NULL);
+  return xhtml->out;
+}
+
+/**
+ * It is a handler who processes the DIV tag.
+ *
+ * @param xhtml  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DIV tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char*
+xhtml_1_0_end_div_tag(Xhtml* xhtml, Node* child)
+{
+  Doc* doc = xhtml->doc;
+  request_rec* r = doc->r;
+
+  xhtml->out = apr_pstrcat(r->pool, xhtml->out, "</div>\n", NULL);
+
+  return xhtml->out;
+}
+
+static void
+xhtml_1_0_chxjif_tag(Xhtml* xhtml, Node* node)
+{
+  Doc*         doc   = xhtml->doc;
+  Node*        child;
+  request_rec* r = xhtml->doc->r;
+
+  for (child = qs_get_child_node(doc, node);
+       child;
+       child = qs_get_next_node(doc, child))
+  {
+    xhtml->out = apr_pstrcat(r->pool, xhtml->out, child->otext, NULL);
+    xhtml_1_0_chxjif_tag(xhtml, child);
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/chxj_xhtml_mobile_1_0.h b/src/chxj_xhtml_mobile_1_0.h
new file mode 100644 (file)
index 0000000..dbef5d9
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __CHXJ_XHTML_MOBILE_1_0_H__
+#define __CHXJ_XHTML_MOBILE_1_0_H__
+
+#include "mod_chxj.h"
+
+/*----------------------------------------------------------------------------*/
+/* Structure for HDML                                                         */
+/*----------------------------------------------------------------------------*/
+typedef struct _Xhtml_t {
+    Doc* doc;
+    char* out;
+    int   out_len;
+
+    device_table* spec;
+    mod_chxj_config* conf;
+} Xhtml;
+
+/*----------------------------------------------------------------------------*/
+/* Prototype                                                                  */
+/*----------------------------------------------------------------------------*/
+char* chxj_exchange_xhtml_mobile_1_0(request_rec* r, device_table *spec, const char* src, apr_size_t srclen, apr_size_t *dstlen);
+
+#endif
diff --git a/src/mod_chxj.c b/src/mod_chxj.c
new file mode 100644 (file)
index 0000000..bf7c2b1
--- /dev/null
@@ -0,0 +1,872 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define DEBUG_PRINT {FILE* fp = fopen("/tmp/deubg.log","a"); fprintf(fp, "%s:%d\n",__FILE__,__LINE__);fclose(fp); }
+#include <unistd.h>
+#include "httpd.h"
+#include "http_config.h"
+#include "http_protocol.h"
+#include "http_log.h"
+#include "ap_config.h"
+#include "apr_strings.h"
+#include "util_filter.h"
+#include "apr_buckets.h"
+#include "apr_lib.h"
+#include "apr_tables.h"
+#include "apr_dso.h"
+#include "apr_general.h"
+#include "apr_pools.h"
+#include <string.h>
+#include "mod_chxj.h"
+#include <qs_ignore_sp.h>
+#include <qs_log.h>
+#include <qs_malloc.h>
+#include <qs_parse_attr.h>
+#include <qs_parse_file.h>
+#include <qs_parse_string.h>
+#include <qs_parse_tag.h>
+#include "chxj_load_device_data.h"
+#include "chxj_load_emoji_data.h"
+#include "chxj_specified_device.h"
+#include "chxj_tag_util.h"
+#include "chxj_xhtml_mobile_1_0.h"
+#include "chxj_hdml.h"
+#include "chxj_chtml10.h"
+#include "chxj_chtml20.h"
+#include "chxj_chtml30.h"
+#include "chxj_jhtml.h"
+
+#ifdef PACKAGE_NAME
+#undef PACKAGE_NAME
+#endif
+
+#ifdef PACKAGE_VERSION
+#undef PACKAGE_VERSION
+#endif
+
+#ifdef PACKAGE_STRING
+#undef PACKAGE_STRING
+#endif
+
+#ifdef PACKAGE_TARNAME
+#undef PACKAGE_TARNAME
+#endif
+
+#include "config.h"
+
+#define CHXJ_VERSION_PREFIX PACKAGE_NAME "/"
+#define CHXJ_VERSION        PACKAGE_VERSION
+
+
+#define DEF_SHMEM_SIZE  (4)
+
+static long shmem_size  = DEF_SHMEM_SIZE;
+
+static const char* HTTP_USER_AGENT = "User-Agent";
+
+
+/**
+ * It converts it from CHTML into ML corresponding to each model. 
+ *
+ * @param r   [i]
+ * @param src [i]   It is former HTML character string. 
+ * @param len [i/o] It is length of former HTML character string. 
+ */
+static char* 
+chxj_exchange(request_rec *r, const char** src, apr_size_t* len)
+{
+  char *user_agent;
+  char *dst = apr_pstrcat(r->pool, (char*)*src, NULL);
+
+  /*------------------------------------------------------------------------*/
+  /* get UserAgent from http header                                         */
+  /*------------------------------------------------------------------------*/
+  user_agent = (char*)apr_table_get(r->headers_in, HTTP_USER_AGENT);
+  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "User-Agent:[%s]", user_agent);
+
+  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, 
+          "start chxj_exchange()");
+  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, 
+          "content type is %s", r->content_type);
+
+  if (strncmp(r->content_type, "text/html",   9) != 0)
+  {
+    ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "content type is %s", r->content_type);
+    return (char*)*src;
+  }
+
+  if (!r->header_only) 
+  {
+    device_table *spec = chxj_specified_device(r, user_agent);
+    if (spec->html_spec_type == CHXJ_SPEC_Chtml_1_0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* DoCoMo i-Mode 1.0                                                    */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select DoCoMo i-Mode 1.0 ");
+      dst = chxj_exchange_chtml10(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else
+    if (spec->html_spec_type == CHXJ_SPEC_Chtml_2_0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* DoCoMo i-Mode 2.0                                                    */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select DoCoMo i-Mode 2.0 ");
+      dst = chxj_exchange_chtml20(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else 
+    if (spec->html_spec_type == CHXJ_SPEC_Chtml_3_0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* DoCoMo i-Mode 3.0                                                    */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select DoCoMo i-Mode 3.0 ");
+      dst = chxj_exchange_chtml30(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else
+    if (spec->html_spec_type == CHXJ_SPEC_Chtml_4_0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* DoCoMo i-Mode 4.0                                                    */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select DoCoMo i-Mode 4.0 ");
+      dst = chxj_exchange_chtml30(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else 
+    if (spec->html_spec_type == CHXJ_SPEC_Chtml_5_0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* DoCoMo i-Mode 5.0                                                    */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select DoCoMo i-Mode 5.0 ");
+      dst = chxj_exchange_chtml30(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else
+    if (spec->html_spec_type == CHXJ_SPEC_XHtml_Mobile_1_0) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* AU XHtml Mobile 1.0 (XHtml Basic 1.0 extended)                       */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select XHTML Mobile 1.0");
+      dst = chxj_exchange_xhtml_mobile_1_0(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else
+    if (spec->html_spec_type == CHXJ_SPEC_Hdml) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* AU HDML Version 3.0 Only                                             */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select HDML");
+      dst = chxj_exchange_hdml(r, spec, *src, *len, len);
+      ap_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
+    }
+    else
+    if (spec->html_spec_type == CHXJ_SPEC_Jhtml) 
+    {
+      /*----------------------------------------------------------------------*/
+      /* J-Phone and Vodaphone                                                */
+      /*----------------------------------------------------------------------*/
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select JHTML");
+      dst = chxj_exchange_jhtml(r, spec, *src, *len, len);
+      *len = strlen(dst);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+    else 
+    {
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "select ?????");
+      ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "html_spec_type[%d]", 
+                      spec->html_spec_type);
+      ap_set_content_type(r, "text/html; charset=Windows-31J");
+    }
+  }
+
+  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "end chxj_exchange()");
+  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "Length=[%d]", *len);
+  if (*len == 0)
+  {
+    dst = apr_psprintf(r->pool, "\n");
+    *len = 1;
+  }
+  dst[*len] = 0;
+  return dst;
+}
+/**
+ * It converts it from POSTDATA .
+ *
+ * @param r   [i]
+ * @param src [i]   It is POSTDATA character string.
+ * @param len [i/o] It is length of former HTML character string.
+ */
+static char*
+chxj_input_exchange(request_rec *r, const char** src, apr_size_t* len)
+{
+  char* pair;
+  char* name;
+  char* value;
+  char* pstate;
+  char* vstate;
+  char* s = apr_pstrdup(r->pool, *src);
+
+  char* result;
+
+  result = qs_alloc_zero_byte_string(r);
+
+  /* _chxj_dmy */
+  /* _chxj_c_ */
+  /* _chxj_r_ */
+  for (;;) 
+  {
+    pair = apr_strtok(s, "&", &pstate);
+    if (pair == NULL)
+    {
+      break;
+    } 
+    s = NULL;
+
+    name  = apr_strtok(pair, "=", &vstate);
+    value = apr_strtok(NULL, "=", &vstate);
+    if (strncasecmp(name, "_chxj", 5) != 0) 
+    {
+      if (strlen(result) != 0)
+      {
+        result = apr_pstrcat(r->pool, result, "&", NULL);
+      }
+      result = apr_pstrcat(r->pool, result, name, "=", value, NULL);
+    }
+    else
+    if (strncasecmp(name, "_chxj_c_", 8) == 0 
+    ||  strncasecmp(name, "_chxj_r_", 8) == 0)
+    {
+      if (value == NULL)
+      {
+        continue;
+      }
+
+      if (strlen(value) == 0)
+      {
+        continue;
+      }
+
+      if (strlen(result) != 0)
+      {
+        result = apr_pstrcat(r->pool, result, "&", NULL);
+      }
+      result = apr_pstrcat(r->pool, result, &name[8], "=", value, NULL);
+    }
+  }
+  *len = strlen(result);
+  return result;
+}
+
+/**
+ * The received data is returned to the filter.
+ *
+ * @param f    [i/o] It is a filter. 
+ * @param data [i]   It is data returned to the filter. 
+ * @param len  [i]   It is length of the data returned to the filter. 
+ */
+static apr_status_t 
+pass_data_to_filter(ap_filter_t *f, const char *data, 
+                                        apr_size_t len)
+{
+  request_rec*        r = f->r;
+  conn_rec*           c = r->connection;
+  apr_status_t        rv;
+  apr_bucket_brigade* bb;
+  apr_bucket*         b;
+
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "start pass_data_to_filter()");
+
+  bb = apr_brigade_create(r->pool, c->bucket_alloc);
+  b  = apr_bucket_transient_create(data, len, c->bucket_alloc);
+
+  APR_BRIGADE_INSERT_TAIL(bb, b);
+  b = apr_bucket_eos_create(f->c->bucket_alloc);
+  APR_BRIGADE_INSERT_TAIL(bb, b);
+
+  rv = ap_pass_brigade(f->next, bb);
+  if (rv != APR_SUCCESS) 
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+                   "ap_pass_brigade()");
+    return rv;
+  }
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, "end pass_data_to_filter()");
+  return rv;
+}
+
+/**
+ * It is the main loop of the output filter. 
+ *
+ * @param f   [i/o] It is a filter.
+ * @param bb  [i]   
+ */
+static apr_status_t 
+chxj_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
+{
+  request_rec* r = f->r;
+  apr_status_t rv = APR_SUCCESS;
+  apr_bucket*  b;
+  const char*  data;
+  char*       contentLength;
+  apr_size_t  len;
+  mod_chxj_ctx* ctx;
+
+
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+          "start of chxj_output_filter()");
+  if (!f->ctx) 
+  {
+    if ((f->r->proto_num >= 1001) 
+    &&  !f->r->main 
+    &&  !f->r->prev) 
+    {
+      f->r->chunked = 1;
+    }
+  }
+
+
+  for (b = APR_BRIGADE_FIRST(bb);
+       b != APR_BRIGADE_SENTINEL(bb); 
+       b = APR_BUCKET_NEXT(b)) 
+  {
+    if (APR_BUCKET_IS_EOS(b)) 
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "eos");
+      /*----------------------------------------------------------------------*/
+      /* End Of File                                                          */
+      /*----------------------------------------------------------------------*/
+      if (f->ctx) 
+      {
+        ctx = (mod_chxj_ctx*)f->ctx;
+        if (strncmp(r->content_type, "text/html",   9) == 0)
+        {
+          if (ctx->len)
+          {
+            char* tmp = apr_palloc(r->pool, ctx->len + 1);
+            memset(tmp, 0, ctx->len + 1);
+            memcpy(tmp, ctx->buffer, ctx->len);
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "input data=[%s]", tmp);
+            ctx->buffer = chxj_exchange(r, (const char**)&tmp, (apr_size_t*)&ctx->len);
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "output data=[%.*s]", ctx->len,ctx->buffer);
+          }
+          else 
+          {
+            ctx->buffer = apr_psprintf(r->pool, "\n");
+            ctx->len += 1;
+          }
+        }
+        contentLength = apr_psprintf(r->pool, "%d", ctx->len);
+        apr_table_setn(r->headers_out, "Content-Length", contentLength);
+        
+        if (ctx->len > 0)
+        {
+          rv = pass_data_to_filter(f, (const char*)ctx->buffer, (apr_size_t)ctx->len);
+        }
+        f->ctx = NULL;
+        return rv;
+      }
+      else
+      {
+        apr_table_setn(r->headers_out, "Content-Length", "0");
+        rv = pass_data_to_filter(f, (const char*)"", (apr_size_t)0);
+        return rv;
+      }
+    }
+    else
+    if (apr_bucket_read(b, &data, &len, APR_BLOCK_READ) == APR_SUCCESS) 
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "read data[%.*s]",len, data);
+
+      if (f->ctx == NULL) 
+      {
+        /*--------------------------------------------------------------------*/
+        /* Start                                                              */
+        /*--------------------------------------------------------------------*/
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "new context");
+        ctx = (mod_chxj_ctx*)apr_palloc(r->pool, sizeof(mod_chxj_ctx));
+        if (len > 0)
+        {
+          ctx->buffer = apr_palloc(r->pool, len);
+          memcpy(ctx->buffer, data, len);
+        }
+        else 
+        {
+          ctx->buffer = apr_palloc(r->pool, 1);
+          ctx->buffer = '\0';
+        }
+        ctx->len = len;
+        f->ctx = (void*)ctx;
+      }
+      else 
+      {
+        /*--------------------------------------------------------------------*/
+        /* append data                                                        */
+        /*--------------------------------------------------------------------*/
+        char* tmp;
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "append data start");
+        ctx = (mod_chxj_ctx*)f->ctx;
+
+        if (len > 0)
+        {
+          tmp = apr_palloc(r->pool, ctx->len);
+          memcpy(tmp, ctx->buffer, ctx->len);
+          ctx->buffer = apr_palloc(r->pool, ctx->len + len);
+          memcpy(ctx->buffer, tmp, ctx->len);
+          memcpy(&ctx->buffer[ctx->len], data, len);
+          ctx->len += len;
+        }
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "append data end");
+      }
+    }
+  }
+  apr_brigade_destroy(bb);
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "end of output filter");
+  return APR_SUCCESS;
+}
+
+/**
+ * It is the main loop of the input filter. 
+ *
+ * @param f         [i/o] It is a filter.
+ * @param bb        [i]   brigade
+ * @param mode      [i]   mode
+ * @param block     [i]   block
+ * @param readbytes [i]   readbyte
+ */
+static apr_status_t 
+chxj_input_filter(ap_filter_t*        f, 
+                 apr_bucket_brigade*  bb,
+                 ap_input_mode_t      mode, 
+                 apr_read_type_e      block,
+                 apr_off_t            readbytes)
+{
+  request_rec*        r = f->r;
+  apr_status_t        rv;
+  conn_rec*           c = r->connection;
+  apr_bucket*         b;
+  /*--------------------------------------------------------------------------*/
+  /* It is the brigade area for output                                        */
+  /*--------------------------------------------------------------------------*/
+  apr_bucket_brigade* ibb;            
+  /*--------------------------------------------------------------------------*/
+  /* It is the brigade area for input                                         */
+  /*--------------------------------------------------------------------------*/
+  apr_bucket_brigade* obb;
+  apr_size_t          len;
+  apr_bucket*         tmp_heap;
+  apr_bucket*         eos;
+  const char*         data;
+  char*               data_bucket;
+  char*               data_brigade;
+
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "start of chxj_input_fileter()");
+
+  data_brigade = qs_alloc_zero_byte_string(r);
+
+
+  ibb = apr_brigade_create(r->pool, c->bucket_alloc);
+  obb = apr_brigade_create(r->pool, c->bucket_alloc);
+
+  rv = ap_get_brigade(f->next, ibb, mode, block, readbytes);
+  if (rv != APR_SUCCESS)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+                    "ap_get_brigade() failed");
+    return rv;
+  }
+
+  APR_BRIGADE_FOREACH(b, ibb) 
+  {
+    rv = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
+    if (rv != APR_SUCCESS) 
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+                     "apr_bucket_read() failed");
+      return rv;
+    }
+
+    if (data != NULL)
+    {
+      data_bucket = apr_palloc(r->pool, len+1);
+      memset((void*)data_bucket, 0, len+1);
+      memcpy(data_bucket, data, len);
+      ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, "(in)POSTDATA:[%s]", data_bucket);
+  
+      data_brigade = apr_pstrcat(r->pool, data_brigade, data_bucket, NULL);
+    }
+
+    if (APR_BUCKET_IS_EOS(b)) 
+    {
+      break;
+    }
+  }
+  apr_brigade_cleanup(ibb);
+
+  len = strlen(data_brigade);
+  if (len == 0)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+                    "data_brigade length is 0");
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "end of chxj_input_fileter()");
+    ap_remove_input_filter(f);
+    return ap_get_brigade(f->next, bb, mode, block, readbytes);
+  }
+  data_brigade = chxj_input_exchange(r, (const char**)&data_brigade, (apr_size_t*)&len);
+
+  if (len > 0)
+  {
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, "(in:exchange)POSTDATA:[%s]", data_brigade);
+
+    obb = apr_brigade_create(r->pool, c->bucket_alloc);
+    tmp_heap = apr_bucket_heap_create(data_brigade, len, NULL, f->c->bucket_alloc);
+    eos      = apr_bucket_eos_create(f->c->bucket_alloc);
+    APR_BRIGADE_INSERT_TAIL(obb, tmp_heap);
+    APR_BRIGADE_INSERT_TAIL(obb, eos);
+    APR_BRIGADE_CONCAT(bb, obb);
+  }
+  ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "end of chxj_input_fileter()");
+  return APR_SUCCESS;
+}
+
+/**
+ * It is processing when the module ends. The shared memory etc. are liberated.
+ *
+ * @param data [i]  The pointer to the server_rec structure is specified. 
+ * @return APR_SUCCESS
+ *
+ */
+apr_status_t 
+chxj_init_module_kill(void *data)
+{
+  server_rec *base_server = (server_rec *)data;
+  mod_chxj_global_config* conf;
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, base_server, 
+                  "start chxj_init_module_kill()");
+
+  /*--------------------------------------------------------------------------*/
+  /* The setting of each server is acquired.                                  */
+  /*--------------------------------------------------------------------------*/
+  conf = ap_get_module_config(base_server->module_config, &chxj_module);
+
+  /*--------------------------------------------------------------------------*/
+  /* The shared memory is liberated.                                          */
+  /*--------------------------------------------------------------------------*/
+  if (conf != NULL&& conf->client_shm != NULL) 
+  {
+    apr_shm_destroy(conf->client_shm);
+    conf->client_shm = NULL;
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, base_server, 
+                  "destroy shared memory.");
+  }
+
+  if (conf != NULL && conf->client_lock != NULL)
+  {
+    apr_global_mutex_destroy(conf->client_lock);
+    conf->client_lock = NULL;
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, base_server, 
+                  "destroy mutex.");
+  }
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, base_server, 
+                  "end chxj_init_module_kill()");
+  return APR_SUCCESS;
+}
+
+static mod_chxj_global_config*
+chxj_global_config_create(server_rec* s)
+{
+  apr_status_t    sts;
+  apr_pool_t      *pool = s->process->pool;
+  void*           shm_segment;
+  apr_size_t      shm_segsize;
+  int*            shm;
+  mod_chxj_global_config* conf;
+  void*           param;
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "start chxj_global_config_create()");
+
+
+  apr_pool_userdata_get(&param, CHXJ_MOD_CONFIG_KEY, pool);
+  conf = (mod_chxj_global_config*)param;
+
+  apr_pool_cleanup_register(pool, s,
+                               chxj_init_module_kill,
+                               chxj_init_module_kill);
+  if (conf)
+  {
+    /*------------------------------------------------------------------------*/
+    /* reused for lifetime of the server                                      */
+    /*------------------------------------------------------------------------*/
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, 
+                   "end chxj_global_config_create() reused.");
+    return conf; 
+  }
+
+  /*--------------------------------------------------------------------------*/
+  /* allocate an own subpool which survives server restarts                   */
+  /*--------------------------------------------------------------------------*/
+  conf = (mod_chxj_global_config*)apr_palloc(pool, 
+                  sizeof(mod_chxj_global_config));
+  conf->client_shm  = NULL;
+  conf->client_lock = NULL;
+  memset(conf->client_lock_file_name, 0, sizeof(conf->client_lock_file_name));
+
+  /*--------------------------------------------------------------------------*/
+  /* Let us cleanup on restarts and exists                                    */
+  /*--------------------------------------------------------------------------*/
+
+
+  sts = apr_shm_create(&conf->client_shm, shmem_size, tmpnam(NULL), pool);
+  if (sts != APR_SUCCESS) 
+  {
+    ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
+                   "chxj_init_module Shared memory securing failure");
+    _exit(1);
+  }
+
+  shm_segment = apr_shm_baseaddr_get(conf->client_shm);
+  shm_segsize = apr_shm_size_get(conf->client_shm);
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                 "chxj_init_module allocated %" APR_SIZE_T_FMT
+                 " bytes of shared memory",
+                 shm_segsize);
+
+  ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
+                 "Shared memory hdml counter initialised");
+
+  shm = (int*)shm_segment;
+  *shm = 0;
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "shm:[%d]", *shm);
+
+  sts = apr_global_mutex_create(&conf->client_lock, 
+                  tmpnam(conf->client_lock_file_name), 
+                  APR_LOCK_DEFAULT, pool);
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mutex create end [%s]", conf->client_lock_file_name);
+  if (sts != APR_SUCCESS) 
+  {
+    ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+                    "chxj_init_module Lock initialization failure");
+    chxj_init_module_kill((void*)s);
+    _exit(1);
+  }
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "lock file:[%s]", conf->client_lock_file_name);
+
+  apr_pool_userdata_set(conf, CHXJ_MOD_CONFIG_KEY,
+                              apr_pool_cleanup_null,
+                              pool);
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "end chxj_global_config_create()");
+  return conf;
+}
+/**
+ * initialize chxj module
+ */
+static int 
+chxj_init_module(apr_pool_t *p, 
+                  apr_pool_t *plog, 
+                  apr_pool_t *ptemp, 
+                  server_rec *s)
+{
+  mod_chxj_global_config* conf;
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "start chxj_init_module()");
+
+  conf = chxj_global_config_create(s);
+
+  ap_add_version_component(p, CHXJ_VERSION_PREFIX CHXJ_VERSION);
+
+  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "end chxj_init_module()");
+  return OK;
+}
+/**
+ * A set structure of each server is generated. 
+ * 
+ * @param p
+ * @param s
+ */
+static void*
+chxj_config_server_create(apr_pool_t *p, server_rec *s)
+{
+  mod_chxj_global_config *gc;
+
+  gc = chxj_global_config_create(s);
+
+  return gc;
+}
+
+/**
+ * The hook is registered.
+ *
+ * @param p
+ */
+static void 
+chxj_register_hooks(apr_pool_t *p)
+{
+  ap_hook_post_config(chxj_init_module,
+                      NULL,
+                      NULL,
+                      APR_HOOK_MIDDLE);
+  ap_register_output_filter (
+                      "chxj_output_filter", 
+                      chxj_output_filter, 
+                      NULL, 
+                      AP_FTYPE_RESOURCE);
+  ap_register_input_filter(
+                      "chxj_input_filter", 
+                      chxj_input_filter, 
+                      NULL, 
+                      AP_FTYPE_RESOURCE);
+#if 0
+                      AP_FTYPE_CONNECTION);
+                      AP_FTYPE_PROTOCOL);
+#endif
+}
+
+/**
+ * A set structure according to the directory is generated. 
+ *
+ * @param p
+ * @param arg
+ */
+static void* 
+chxj_create_per_dir_config(apr_pool_t *p, char *arg) 
+{
+  mod_chxj_config* conf;
+
+  conf = apr_pcalloc(p, sizeof(mod_chxj_config));
+  conf->device_data_file = NULL;
+
+
+  return conf;
+}
+
+/**
+ * The device definition file is loaded. 
+ *
+ * @param arg     [i]   The name of the device definition file is specified.
+ * @param mconfig [i/o] The pointer to a set structure is specified. 
+ * @param parms   [i]   
+ */
+static const char* 
+cmd_load_device_data(cmd_parms *parms, void *mconfig, const char* arg) 
+{
+  mod_chxj_config* conf;
+  Doc doc;
+  doc.r = NULL;
+  if (strlen(arg) > 256) 
+  {
+    return "device data filename too long.";
+  }
+
+  conf = (mod_chxj_config*)mconfig;
+  conf->device_data_file = apr_pstrdup(parms->pool, arg);
+
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  qs_parse_file((Doc*)&doc, (const char*)arg);
+  chxj_load_device_data(&doc,parms->pool, conf);
+  qs_all_free(&doc, QX_LOGMARK);
+  return NULL;
+}
+
+/**
+ * Device definition information is loaded. 
+ *
+ * @param parms 
+ * @param arg     [i]   The name of the device definition file is specified. 
+ * @param mconfig [i/o] The pointer to a set structure is specified. 
+ * @return 
+ */
+static const char* 
+cmd_load_emoji_data(cmd_parms *parms, void *mconfig, const char* arg) 
+{
+  mod_chxj_config* conf;
+  char* rtn;
+  Doc doc;
+  doc.r = NULL;
+
+  if (strlen(arg) > 256) 
+  {
+    return "emoji data filename too long.";
+  }
+
+  conf = (mod_chxj_config*)mconfig;
+  conf->emoji_data_file = apr_pstrdup(parms->pool, arg);
+  qs_init_malloc(&doc);
+  qs_init_root_node(&doc);
+
+  qs_parse_file((Doc*)&doc, (const char*)arg);
+  rtn = chxj_load_emoji_data(&doc,parms->pool, conf);
+  qs_all_free(&doc, QX_LOGMARK);
+
+  return rtn;
+}
+
+static const command_rec cmds[] = {
+  AP_INIT_TAKE1(
+    "LoadDeviceData",
+    cmd_load_device_data,
+    NULL,
+    OR_ALL,
+    "Load Device Data"),
+  AP_INIT_TAKE1(
+    "LoadEmojiData",
+    cmd_load_emoji_data,
+    NULL,
+    OR_ALL,
+    "Load Emoji Data"),
+  { NULL },
+};
+
+
+/*----------------------------------------------------------------------------*/
+/* Dispatch list for API hooks                                                */
+/*----------------------------------------------------------------------------*/
+module AP_MODULE_DECLARE_DATA chxj_module = 
+{
+  STANDARD20_MODULE_STUFF, 
+  chxj_create_per_dir_config,          /* create per-dir    config structures */
+  NULL,                                /* merge  per-dir    config structures */
+  chxj_config_server_create,           /* create per-server config structures */
+  NULL,                                /* merge  per-server config structures */
+  cmds,                                /* table of config file commands       */
+  chxj_register_hooks                  /* register hooks                      */
+};
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/mod_chxj.h b/src/mod_chxj.h
new file mode 100644 (file)
index 0000000..19607b6
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __MOD_CHXJ_H__
+#define __MOD_CHXJ_H__
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_protocol.h"
+#include "http_log.h"
+#include "ap_config.h"
+#include "apr_strings.h"
+#include "util_filter.h"
+#include "apr_buckets.h"
+#include "apr_lib.h"
+#include "apr_tables.h"
+#include "apr_dso.h"
+#include "apr_general.h"
+#include "apr_pools.h"
+#include <string.h>
+#include <qs_ignore_sp.h>
+#include <qs_log.h>
+#include <qs_malloc.h>
+#include <qs_parse_attr.h>
+#include <qs_parse_file.h>
+#include <qs_parse_string.h>
+#include <qs_parse_tag.h>
+
+#include "chxj_specified_device.h"
+
+
+typedef struct _imode_emoji_t {
+  char  hex1byte;
+  char  hex2byte;
+  char* string;
+  char *description;
+} imode_emoji;
+
+typedef struct _ezweb_emoji_t {
+  char* typeA;
+  char* typeB;
+  char* typeC;
+  char* typeD;
+} ezweb_emoji;
+
+typedef struct _jphone_emoji_t {
+  char* string;
+} jphone_emoji;
+
+typedef struct _emoji_t {
+  struct _emoji_t* next;
+  int no;
+  imode_emoji* imode;
+  ezweb_emoji* ezweb;
+  jphone_emoji* jphone;
+} emoji_t;
+
+typedef struct _mod_chxj_config_t 
+{
+  char*               device_data_file;
+  char*               emoji_data_file;
+  device_table_list*  devices;
+  emoji_t*            emoji;
+  emoji_t*            emoji_tail;
+} mod_chxj_config;
+
+typedef struct _mod_chxj_global_config_t
+{
+  apr_shm_t*          client_shm;
+  apr_global_mutex_t* client_lock;
+  char                client_lock_file_name[256];
+} mod_chxj_global_config;
+
+typedef struct _mod_chxj_ctx_t
+{
+  unsigned int len;
+
+  apr_bucket_brigade *bb;
+
+  char* buffer;
+} mod_chxj_ctx;
+
+#include "chxj_tag_util.h"
+
+#define CHXJ_MOD_CONFIG_KEY   "chxj_module"
+
+module AP_MODULE_DECLARE_DATA chxj_module;
+
+
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_ignore_sp.c b/src/qs_ignore_sp.c
new file mode 100644 (file)
index 0000000..ebbead3
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "qs_parse_string.h"
+
+/**
+ * ignore space
+ */
+QS_EXPORT int
+qs_ignore_sp(Doc* doc, const char* s, int len) {
+  int ii;
+  char* sp = (char*)s;
+
+  for(ii=0;
+      *sp && is_white_space(*sp) && ii<len;
+      ii++, sp++) {
+  }
+
+  return (sp - s);
+}
+
+QS_EXPORT int
+qs_ignore_sp_and_quote(Doc* doc, const char* s, int len) {
+  int ii;
+  char* sp = (char*)s;
+
+  for(ii=0;
+      *sp && (is_white_space(*sp) || is_quote(*sp)) && ii<len;
+      ii++, sp++) {
+  }
+
+  return (sp - s);
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_ignore_sp.h b/src/qs_ignore_sp.h
new file mode 100644 (file)
index 0000000..fc175a3
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_IGNORE_SP_H__
+#define __QS_IGNORE_SP_H__
+#include "qs_parse_string.h"
+
+QS_EXPORT int qs_ignore_sp(Doc* doc, const char*, int);
+QS_EXPORT int qs_ignore_sp_and_quote(Doc* doc, const char* s, int len) ;
+
+#endif
diff --git a/src/qs_log.c b/src/qs_log.c
new file mode 100644 (file)
index 0000000..a129ce8
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include "qs_log.h"
+
+QS_EXPORT void
+qs_log(Doc* doc, int log_level,const char* f, int l, char* msg) 
+{
+#ifdef USE_LOG
+  switch(log_level) {
+  case QX_LOG_DEBUG:
+#ifdef DEBUG
+    fprintf(stderr, "DBG:[%20.20s][%10d]: - <%s>\n", f,l,msg);
+#endif
+    break;
+  case QX_LOG_INFO:
+    fprintf(stderr, "INF:[%20.20s][%10d]: - <%s>\n", f,l,msg);
+    break;
+  case QX_LOG_WARN:
+    fprintf(stderr, "WRN:[%20.20s][%10d]: - <%s>\n", f,l,msg);
+    break;
+  case QX_LOG_ERROR:
+    fprintf(stderr, "ERR:[%20.20s][%10d]: - <%s>\n", f,l,msg);
+    break;
+  case QX_LOG_FATAL:
+    fprintf(stderr, "FTL:[%20.20s][%10d]: - <%s>\n", f,l,msg);
+    qs_all_free(QX_LOGMARK);
+    _exit(0);
+    break;
+  }
+#endif
+}
+
+void
+qs_log_int(Doc* doc, int log_level,const char* f, int l, char*msg, int val) 
+{
+#ifdef USE_LOG
+  switch(log_level) {
+  case QX_LOG_DEBUG:
+#ifdef DEBUG
+    fprintf(stderr, "DBG:[%20.20s][%10d]: - <%s:%d>\n", f,l,msg, val);
+#endif
+    break;
+  case QX_LOG_INFO:
+    fprintf(stderr, "INF:[%20.20s][%10d]: - <%s:%d>\n", f,l,msg,val);
+    break;
+  case QX_LOG_WARN:
+    fprintf(stderr, "WRN:[%20.20s][%10d]: - <%s:%d>\n", f,l,msg,val);
+    break;
+  case QX_LOG_ERROR:
+    fprintf(stderr, "ERR:[%20.20s][%10d]: - <%s:%d>\n", f,l,msg,val);
+    break;
+  case QX_LOG_FATAL:
+    fprintf(stderr, "FTL:[%20.20s][%10d]: - <%s:%d>\n", f,l,msg,val);
+    _exit(0);
+    break;
+  }
+#endif
+}
diff --git a/src/qs_log.h b/src/qs_log.h
new file mode 100644 (file)
index 0000000..dceef4e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_LOG_H__
+#define __QS_LOG_H__
+#include "qs_parse_string.h"
+
+#define QX_LOGMARK   __FILE__,__LINE__
+#define QX_LOG_DEBUG (0)
+#define QX_LOG_INFO  (1)
+#define QX_LOG_WARN  (2)
+#define QX_LOG_ERROR (3)
+#define QX_LOG_FATAL (4)
+
+
+#define QX_LOGGER_DEBUG(c)  qs_log(doc,QX_LOG_DEBUG,QX_LOGMARK,(c))
+#define QX_LOGGER_INFO(c)   qs_log(doc,QX_LOG_INFO,QX_LOGMARK, (c))
+#define QX_LOGGER_WARN(c)   qs_log(doc,QX_LOG_WARN,QX_LOGMARK, (c))
+#define QX_LOGGER_ERROR(c)  qs_log(doc,QX_LOG_ERROR,QX_LOGMARK, (c))
+#define QX_LOGGER_FATAL(c)  qs_log(doc,QX_LOG_FATAL,QX_LOGMARK,(c))
+#define QX_LOGGER_DEBUG_INT(x,y)  qs_log_int(doc,QX_LOG_DEBUG,QX_LOGMARK,(x),(y))
+
+QS_EXPORT void qs_log(Doc* doc, int log_level,const char* f, int l, char* msg);
+QS_EXPORT void qs_log_int(Doc* doc, int log_level,const char* f, int l, char* msg, int val);
+#endif
diff --git a/src/qs_malloc.c b/src/qs_malloc.c
new file mode 100644 (file)
index 0000000..d432304
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include "qs_log.h"
+#include "qs_malloc.h"
+
+/**
+ * Init
+ */
+QS_EXPORT void
+qs_init_malloc(Doc* doc) {
+  int ii;
+  for (ii=0; ii<QX_ALLOC_MAX; ii++) {
+    doc->pointer_table[ii].address = 0;
+    doc->pointer_table[ii].size    = 0;
+  }
+  doc->do_init_flag = 1;
+}
+
+/**
+ *it is a wrapper of "malloc()" function. 
+ */
+QS_EXPORT void*
+qs_malloc(Doc* doc, int size, const char* fname, int line) {
+  int ii;
+  if (doc->do_init_flag == 0) {
+    qs_init_malloc(doc);
+  }
+  if (doc->alloc_size + size >= QX_ALLOC_MAX_SIZE) {
+    QX_LOGGER_FATAL("Out Of Memory");
+  }
+  void* src = (void*)malloc(size);
+  if (src == NULL) {
+    QX_LOGGER_FATAL("Out Of Memory");
+  }
+#ifdef MALLOC_TRACE
+  char buffer[BUFSIZ];
+  sprintf(buffer,"malloc Address:[0x%x]", src);
+  qs_log(doc,QX_LOG_DEBUG,fname,line,buffer);
+#endif
+  for (ii=0; ii<QX_ALLOC_MAX; ii++) {
+    if (doc->pointer_table[ii].address == (unsigned int)src) {
+      QX_LOGGER_DEBUG("use old space");
+      doc->alloc_size -= doc->pointer_table[ii].size;
+      doc->pointer_table[ii].size = size;
+      doc->alloc_size += doc->pointer_table[ii].size;
+      break;
+    }
+  }
+  if (ii == QX_ALLOC_MAX)  {
+    for (ii=0; ii<QX_ALLOC_MAX; ii++) {
+      if (doc->pointer_table[ii].address == 0) {
+        doc->pointer_table[ii].address = (unsigned int)src;
+        doc->pointer_table[ii].size = size;
+        doc->alloc_size += size;
+        QX_LOGGER_DEBUG("use new space");
+        break;
+      }
+    }
+  }
+  if (ii == QX_ALLOC_MAX) {
+    QX_LOGGER_FATAL("Out Of Memory");
+  }
+  QX_LOGGER_DEBUG_INT("allocated memory size",doc->alloc_size);
+  return src;
+}
+
+/**
+ *it is a wrapper of "free()" function. 
+ */
+QS_EXPORT void
+qs_free(Doc* doc, void *s, const char* fname, int line) {
+  int ii;
+#ifdef MALLOC_TRACE
+  char buffer[BUFSIZ];
+  sprintf(buffer,"free Address:[0x%x]", s);
+  qs_log(doc,QX_LOG_DEBUG,fname,line,buffer);
+#endif
+  for (ii=0; ii<QX_ALLOC_MAX; ii++) {
+    if (doc->pointer_table[ii].address == (unsigned int)s) {
+      doc->pointer_table[ii].address = 0;
+      doc->alloc_size -= doc->pointer_table[ii].size;
+      doc->pointer_table[ii].size = 0;
+    }
+  }
+  free(s);
+}
+
+
+QS_EXPORT void
+qs_all_free(Doc* doc, const char* fname, int line) {
+  int ii;
+  if (doc->do_init_flag) {
+    for (ii=0; ii<QX_ALLOC_MAX; ii++) {
+      if (doc->pointer_table[ii].address != 0) {
+        qs_free(doc, (void*)doc->pointer_table[ii].address,fname, line);
+      }
+    }
+  }
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_malloc.h b/src/qs_malloc.h
new file mode 100644 (file)
index 0000000..692a885
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_MALLOC_H__
+#define __QS_MALLOC_H__
+#include "qs_parse_string.h"
+
+#define QX_ALLOC_MAX_SIZE (1024*1024)
+
+/**
+ * Not return NULL;
+ */
+QS_EXPORT void* qs_malloc(Doc* doc, int size, const char* fname, int line) ;
+QS_EXPORT void qs_init_malloc(Doc* doc);
+QS_EXPORT void qs_free(Doc* doc,void *s, const char* fname, int line) ;
+QS_EXPORT void qs_all_free(Doc* doc, const char* fname, int line);
+#endif
diff --git a/src/qs_parse_attr.c b/src/qs_parse_attr.c
new file mode 100644 (file)
index 0000000..6b1d699
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include "qs_malloc.h"
+#include "qs_parse_string.h"
+#include "qs_parse_attr.h"
+#include "qs_log.h"
+#include "qs_ignore_sp.h"
+
+
+QS_EXPORT Attr*
+qs_parse_attr(Doc* doc, const char*s, int len, int *pos) {
+  int ii;
+  int start_pos;
+  int size;
+  int novalue;
+  char* name;
+  char* value;
+  Attr* attr;
+  int use_quote = 0;
+
+  QX_LOGGER_DEBUG("start qs_parse_attr()");
+
+  /* ignore space */
+  ii = start_pos = qs_ignore_sp_and_quote(doc, s, len);
+  QX_LOGGER_DEBUG_INT("len",len);
+
+  /* get attr name */
+  for (;ii<len; ii++) {
+    QX_LOGGER_DEBUG((char*)&s[ii]);
+    if (is_white_space(s[ii])) {
+      break;
+    }
+    if (s[ii] == '=') {
+      break;
+    }
+  }
+
+  size = ii - start_pos;
+  QX_LOGGER_DEBUG_INT("size", size);
+  /* not found */
+  if (size == 0) {
+    *pos = ii;
+    return NULL;
+  }
+  name = (char*)qs_malloc(doc, size+1, QX_LOGMARK);
+  memset(name, 0, size+1);
+  memcpy(name, &s[start_pos], size);
+  QX_LOGGER_DEBUG((char*)&s[start_pos]);
+  QX_LOGGER_DEBUG((char*)name);
+
+  novalue = 0;
+  /* find '=' */
+  for (;ii<len; ii++) {
+    if (is_white_space(s[ii])) {
+      /* ignore */
+      continue;
+    }
+    if (s[ii] == '=') {
+      ii++;
+    }
+    else {
+      /* novalue */
+      novalue = 1;
+    }
+    break;
+  }
+
+  if (ii == len) {
+    novalue = 1;
+  }
+
+  size = 0;
+  if (!novalue) {
+    /* ignore space */
+    ii += qs_ignore_sp(doc, &s[ii], len-ii);
+    for (;ii<len; ii++) {
+      if (s[ii] == '\'' || s[ii] == '"') {
+        use_quote = 1;
+        ii++;
+        break;
+      }
+      if (!is_white_space(s[ii])) {
+        break;
+      }
+    }
+  
+    start_pos = ii;
+    /* get attr value */
+    for (;ii<len; ii++) {
+      if (is_sjis_kanji(s[ii])) {
+        ii++;
+        continue;
+      }
+      if (is_sjis_kana(s[ii])) {
+        continue;
+      }
+      if (is_white_space(s[ii])) {
+        if (! use_quote) {
+          break;
+        }
+      }
+      if (s[ii] == '"') {
+        break;
+      }
+      if (s[ii] == '\'') {
+        break;
+      }
+    }
+    size = ii - start_pos;
+    QX_LOGGER_DEBUG_INT("size",size);
+    QX_LOGGER_DEBUG((char*)&s[start_pos]);
+  }
+
+  value = (char*)qs_malloc(doc, size+1, QX_LOGMARK);
+  memset(value, 0, size+1);
+  if (size != 0) {
+    memcpy(value, &s[start_pos], size);
+  }
+
+  attr = qs_new_attr(doc);
+  attr->name = name;
+  attr->value = value;
+  QX_LOGGER_DEBUG(attr->name);
+  QX_LOGGER_DEBUG(attr->value);
+
+  QX_LOGGER_DEBUG("end qs_parse_attr()");
+  *pos = ii;
+  return attr;
+}
+
+QS_EXPORT Attr*
+qs_new_attr(Doc* doc) {
+  Attr* attr = (Attr*)qs_malloc(doc,sizeof(Attr),QX_LOGMARK);
+  if (attr == NULL) {
+    QX_LOGGER_FATAL("Out Of Memory");
+  }
+  attr->next   = NULL;
+  attr->parent = NULL;
+  attr->name   = NULL;
+  attr->value  = NULL;
+  return attr;
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_parse_attr.h b/src/qs_parse_attr.h
new file mode 100644 (file)
index 0000000..39ef059
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_ATTR_H__
+#define __QS_PARSE_ATTR_H__
+#include "qs_parse_string.h"
+
+QS_EXPORT Attr* qs_parse_attr(Doc* doc, const char*s, int len, int* newpos);
+QS_EXPORT Attr* qs_new_attr(Doc* doc);
+#endif
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_parse_file.c b/src/qs_parse_file.c
new file mode 100644 (file)
index 0000000..55ad303
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <strings.h>
+#include "qs_malloc.h"
+#include "qs_parse_string.h"
+#include "qs_parse_file.h"
+#include "qs_parse_tag.h"
+#include "qs_log.h"
+
+QS_EXPORT Node*
+qs_parse_file(Doc* doc, const char* filename) {
+  FILE* fp;
+  char buffer[256];
+  char *tgt = NULL;
+  char *tmp = NULL;
+
+  fp = fopen(filename, "r");
+  if (fp == NULL) {
+    return NULL;
+  }
+
+  tgt = (char*)qs_malloc(doc, 1, QX_LOGMARK);
+  tgt[0] = 0;
+  while((fgets(buffer, 256, fp)) != NULL) {
+    tmp = (char*)qs_malloc(doc,strlen(tgt)+1, QX_LOGMARK);
+    memset(tmp, 0, strlen(tgt)+1);
+    memcpy(tmp, tgt, strlen(tgt));
+    qs_free(doc,tgt, QX_LOGMARK);
+    tgt = (char*)qs_malloc(doc,strlen(tmp)+ strlen(buffer)+1, QX_LOGMARK);
+    memset(tgt, 0, strlen(tmp)+strlen(buffer)+1);
+    memcpy(tgt, tmp,strlen(tmp));
+    memcpy(&tgt[strlen(tmp)], buffer, strlen(buffer));
+    qs_free(doc,tmp, QX_LOGMARK);
+  }
+  fclose(fp);
+
+  return qs_parse_string(doc, tgt);
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_parse_file.h b/src/qs_parse_file.h
new file mode 100644 (file)
index 0000000..c44bc53
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_FILE_H__
+#define __QS_PARSE_FILE_H__
+#include "qs_parse_string.h"
+
+/*
+ * Prototype Declare
+ */
+QS_EXPORT Node* qs_parse_file(Doc* doc, const char* filename) ;
+#endif
diff --git a/src/qs_parse_string.c b/src/qs_parse_string.c
new file mode 100644 (file)
index 0000000..ff1d525
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include <strings.h>
+#include "qs_malloc.h"
+#include "qs_parse_string.h"
+#include "qs_parse_tag.h"
+#include "qs_log.h"
+
+static int s_cut_tag (const char* s, int len) ;
+static int s_cut_text(const char* s, int len) ;
+
+
+QS_EXPORT Node*
+qs_parse_string(Doc* doc, const char* src) {
+  int ii;
+  int srclen = strlen(src);
+
+#ifdef DEBUG
+  QX_LOGGER_DEBUG("parse_string start");
+#endif
+  doc->now_parent_node = qs_init_root_node(doc);
+
+#ifdef DEBUG
+  QX_LOGGER_DEBUG("root_node init end");
+#endif
+
+  for (ii=0; ii<srclen; ii++) {
+    if (is_white_space(src[ii])) {
+#ifdef DEBUG
+      QX_LOGGER_DEBUG("white_space");
+#endif
+      continue;
+    }
+    if ((unsigned char)'<' == src[ii]) {
+      int endpoint = s_cut_tag(&src[ii], srclen - ii);
+      Node* node   = qs_parse_tag(doc, &src[ii], endpoint);
+      ii += endpoint;
+      if (node->name[0] == '/' ) {
+        if (has_child(node->name)) {
+#ifdef DEBUG
+         {char buf[256]; sprintf(buf, "[%s]->[%s]", 
+                         doc->now_parent_node->name, 
+                         doc->now_parent_node->parent->name); QX_LOGGER_DEBUG(buf);}
+#endif
+          doc->now_parent_node = doc->now_parent_node->parent;
+        }
+        qs_free_node(doc,node);
+        continue;
+      }
+      if (strncmp(node->name, "!--", 3) == 0) {
+        /* comment tag */
+        qs_free_node(doc, node);
+        continue;
+      }
+      qs_add_child_node(doc,node);
+      if (has_child(node->name)) {
+#ifdef DEBUG
+        {char buf[256]; sprintf(buf, "[%s]->[%s]", doc->now_parent_node->name, node->name); QX_LOGGER_DEBUG(buf);}
+#endif
+        doc->now_parent_node = node;
+      }
+    }
+    else {
+      /* TEXT */
+      int endpoint = s_cut_text(&src[ii], srclen - ii);
+      Node* node = qs_new_tag(doc);
+      node->value = (char*)qs_malloc(doc,endpoint+1, QX_LOGMARK);
+      node->name  = (char*)qs_malloc(doc,4+1,        QX_LOGMARK);
+      node->otext = (char*)qs_malloc(doc,endpoint+1, QX_LOGMARK);
+      node->size  = endpoint;
+      memset(node->value, 0, endpoint+1);
+      memset(node->otext, 0, endpoint+1);
+      memset(node->name,  0, 4+1       );
+      memcpy(node->value, &src[ii], endpoint);
+      memcpy(node->name,  "text",   4);
+      memcpy(node->otext,node->value, endpoint);
+
+      qs_add_child_node(doc,node);
+      ii += (endpoint - 1);
+    }
+  }
+#ifdef DEBUG
+  QX_LOGGER_DEBUG("parse_string end");
+#endif
+
+  return doc->root_node;
+}
+
+
+
+static int
+s_cut_tag(const char* s, int len) {
+  int lv = 0;
+  int ii;
+
+  for (ii=0;ii<len; ii++) {
+    if (is_sjis_kanji(s[ii])) {
+      ii++;
+      continue;
+    }
+    if (is_sjis_kana(s[ii])) {
+      continue;
+    }
+
+    if (is_white_space(s[ii])) {
+      continue;
+    }
+
+    if (s[ii] == '<') {
+      lv++;
+      continue;
+    }
+
+    if (s[ii] == '>') {
+      lv--;
+      if (lv == 0) {
+        break;
+      }
+      continue;
+    }
+  }
+  return ii;
+}
+
+static int
+s_cut_text(const char* s, int len) {
+  int ii;
+  for (ii=0;ii<len; ii++) {
+    if (is_sjis_kanji(s[ii])) {
+      ii++;
+      continue;
+    }
+    if (is_sjis_kana(s[ii])) {
+      continue;
+    }
+
+    if (is_white_space(s[ii])) {
+      continue;
+    }
+
+    if (s[ii] == '<') {
+      break;
+    }
+  }
+
+  return ii;
+}
+
+
+QS_EXPORT Node*
+qs_init_root_node(Doc* doc) {
+  doc->root_node = (Node*)qs_malloc(doc,sizeof(struct _node),QX_LOGMARK);
+  if (doc->root_node == NULL) {
+    QX_LOGGER_FATAL("Out Of Memory");
+  }
+  doc->root_node->next   = NULL;
+  doc->root_node->parent = NULL;
+  doc->root_node->child  = NULL;
+  doc->root_node->attr   = NULL;
+
+  doc->root_node->name   = (char*)qs_malloc(doc,5,QX_LOGMARK);
+  if (doc->root_node->name == NULL) {
+    QX_LOGGER_FATAL("Out Of Memory");
+  }
+  memset(doc->root_node->name, 0, 5);
+  strcpy(doc->root_node->name, "ROOT");
+
+  return doc->root_node;
+}
+
+
+
+QS_EXPORT void
+qs_add_child_node(Doc* doc,Node* node) 
+{
+  node->next       = NULL;
+  node->child      = NULL;
+  node->child_tail = NULL;
+  node->parent = doc->now_parent_node;
+  if (doc->now_parent_node->child == NULL) 
+  {
+    doc->now_parent_node->child      = node;
+    doc->now_parent_node->child_tail = node;
+  }
+  else 
+  {
+#ifdef DEBUG
+    QX_LOGGER_DEBUG("search child free node");
+#endif
+    doc->now_parent_node->child_tail->next = node;
+    doc->now_parent_node->child_tail       = node;
+  }
+}
+
+
+
+QS_EXPORT void
+qs_free_node(Doc* doc, Node* node) {
+  qs_free(doc,node->name, QX_LOGMARK);
+  Attr* attr;
+  Attr* nattr;
+
+  for (attr = node->attr; attr ; attr = nattr) {
+    nattr = attr->next;
+    qs_free(doc,attr->name, QX_LOGMARK);
+    qs_free(doc,attr->value, QX_LOGMARK);
+    qs_free(doc,attr, QX_LOGMARK);
+  }
+
+  qs_free(doc,node, QX_LOGMARK);
+}
+
+
+
+
+QS_EXPORT Node*
+qs_get_root(Doc* doc) {
+  return doc->root_node;
+}
+
+
+
+
+QS_EXPORT char* 
+qs_get_node_value(Doc* doc, Node* node) {
+  return node->value;
+}
+
+
+
+
+QS_EXPORT char*
+qs_get_node_name(Doc* doc, Node* node) {
+  return node->name;
+}
+
+
+
+QS_EXPORT Node*
+qs_get_child_node(Doc* doc, Node* node) {
+  return node->child;
+}
+
+
+
+
+QS_EXPORT Node*
+qs_get_next_node(Doc* doc, Node* node) {
+  return node->next;
+}
+
+
+
+QS_EXPORT Attr*
+qs_get_attr(Doc* doc, Node* node) {
+  return node->attr;
+}
+
+
+
+
+QS_EXPORT Attr*
+qs_get_next_attr(Doc* doc, Attr* attr) {
+  return attr->next;
+}
+
+
+
+QS_EXPORT char*
+qs_get_attr_name(Doc* doc, Attr* attr) {
+  return attr->name;
+}
+
+
+
+QS_EXPORT char*
+qs_get_attr_value(Doc* doc, Attr* attr) {
+  return attr->value;
+}
+
+QS_EXPORT int 
+qs_get_node_size(Doc* doc, Node* node) {
+  return node->size;
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_parse_string.h b/src/qs_parse_string.h
new file mode 100644 (file)
index 0000000..bf8813e
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_STRING_H__
+#define __QS_PARSE_STRING_H__
+#include <httpd.h>
+/**
+ * Max of memory allocation times.
+ */
+#define QX_ALLOC_MAX   (4096)
+
+/**
+ * It is judged whether it is the first byte of Japanese Shift_JIS "ZENKAKU KANJI". 
+ */
+#define is_sjis_kanji(c)  ((0x81 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0x9f)  \
+                          || (0xe0 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xfc))
+/**
+ * It is judged whether it is a byte of Japanese Shift_JIS "HANKAKU KANA". 
+ */
+#define is_sjis_kana(c)   ((0xa1 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xdf))
+
+/**
+ * It is judged whether it is a Japanese code part of EUC. 
+ */
+#define is_euc_kanji(c)   (0xa1 <= (unsigned char)(c&0xff) && (unsigned char)(c&0xff) <= 0xfe)
+
+/**
+ * It is judged whether it is a Japanese code part of EUC "KANA". 
+ */
+#define is_euc_kana(c)    (0x8e == (unsigned char)(c&0xff))
+
+/**
+ * True is returned for whitespace. 
+ */
+#define is_white_space(c)     (' ' == (unsigned char)(c&0xff)  \
+                           || '\t' == (unsigned char)(c&0xff) \
+                           || '\n' == (unsigned char)(c&0xff) \
+                           || '\r' == (unsigned char)(c&0xff))
+
+/**
+ * True is returned for the quotation mark. 
+ */
+#define is_quote(c)       ('\'' == (unsigned char)(c&0xff) \
+                         ||'"'  == (unsigned char)(c&0xff))
+
+/**
+ * It is judged whether the tag of the object has the child element. 
+ * The "<option>" tag has the child. Please write </ option >. 
+ */
+#define has_child(c)       ((strcasecmp(c, "base"     ) != 0) \
+                        &&  (strcasecmp(c, "meta"     ) != 0) \
+                        &&  (strcasecmp(c, "br"       ) != 0) \
+                        &&  (strcasecmp(c, "dt"       ) != 0) \
+                        &&  (strcasecmp(c, "dd"       ) != 0) \
+                        &&  (strcasecmp(c, "hr"       ) != 0) \
+                        &&  (strcasecmp(c, "img"      ) != 0) \
+                        &&  (strcasecmp(c, "input"    ) != 0) \
+                        &&  (strcasecmp(c, "li"       ) != 0) \
+                        &&  (strcasecmp(c, "p"        ) != 0) \
+                        &&  (strcasecmp(c, "plaintext") != 0) \
+                        &&  (strcasecmp(c, "?xml"     ) != 0) \
+                        &&  (strcasecmp(c, "!--"      ) != 0))
+
+/**
+ * The structure of the attribute is defined.
+ */
+typedef struct _attr {
+  struct _attr* next;
+  struct _node* parent;
+  char *name;
+  char *value;
+} Attr;
+
+/**
+ * The structure of the element is defined. 
+ */
+typedef struct _node {
+  struct _node* next;
+  struct _node* parent;
+  struct _node* child;
+  struct _node* child_tail;
+  struct _attr* attr;
+  struct _attr* attr_tail;
+  char* name;
+  char* value;
+  int   size;
+  char* otext;
+} Node;
+
+typedef struct pointer_table_t {
+  unsigned int address;
+  unsigned int size;
+} Pointer_Table;
+
+
+
+typedef struct _doc {
+  Node*         now_parent_node;
+  Node*         root_node;
+
+  int           do_init_flag;
+  unsigned int  alloc_size;
+
+  Pointer_Table pointer_table[QX_ALLOC_MAX];
+
+#ifndef __NON_MOD_CHXJ__
+  request_rec* r;
+#endif
+} Doc;
+
+#ifdef __NON_MOD_CHXJ__
+#define QS_EXPORT 
+#else
+/*
+#define QS_EXPORT static
+*/
+#define QS_EXPORT
+#endif
+
+/*
+ * Prototype Declare
+ */
+QS_EXPORT Node* qs_init_root_node(Doc* doc);
+QS_EXPORT void qs_add_child_node(Doc* doc, Node*);
+QS_EXPORT void qs_free_node(Doc* doc, Node*);
+QS_EXPORT Node* qs_get_root(Doc* doc) ;
+QS_EXPORT Node* qs_parse_string(Doc* doc, const char*);
+QS_EXPORT char* qs_get_node_value(Doc* doc,Node* node);
+QS_EXPORT char* qs_get_node_name(Doc* doc, Node* node) ;
+QS_EXPORT int qs_get_node_size(Doc* doc, Node* node) ;
+QS_EXPORT Node* qs_get_child_node(Doc* doc, Node* node) ;
+QS_EXPORT Node* qs_get_next_node(Doc* doc, Node* node) ;
+QS_EXPORT Attr* qs_get_attr(Doc* doc, Node* node) ;
+QS_EXPORT Attr* qs_get_next_attr(Doc* doc, Attr* attr) ;
+QS_EXPORT char* qs_get_attr_name(Doc* doc, Attr* attr) ;
+QS_EXPORT char* qs_get_attr_value(Doc* doc, Attr* attr) ;
+#endif
diff --git a/src/qs_parse_tag.c b/src/qs_parse_tag.c
new file mode 100644 (file)
index 0000000..0ae81ab
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdio.h>
+#include "qs_malloc.h"
+#include "qs_parse_string.h"
+#include "qs_log.h"
+#include "qs_parse_attr.h"
+#include "qs_parse_tag.h"
+
+static char* s_get_tag_name(Doc* doc, const char* s, int len) ; 
+
+
+
+QS_EXPORT Node*
+qs_parse_tag(Doc* doc, const char* s, int len) {
+  Node* node;
+  char *tag_name;
+  char *sp = (char*)s;
+  int ll = len;
+  int next_point = 0;
+
+  QX_LOGGER_DEBUG("start parse_tag()");
+
+
+  /* s[0] == '<' && s[len-1] == '>' */
+  tag_name = (char *)s_get_tag_name(doc, ++s, --ll);
+  QX_LOGGER_DEBUG_INT("ll",ll);
+  node = (Node*)qs_new_tag(doc);
+  node->name = tag_name;
+  node->otext = qs_malloc(doc,len+2, QX_LOGMARK);
+  memset(node->otext, 0, len+2);
+  memcpy(node->otext, sp, len+1);
+
+  QX_LOGGER_DEBUG(tag_name);
+
+  ll -= (strlen(tag_name));
+  QX_LOGGER_DEBUG_INT("ll",ll);
+  sp += (strlen(tag_name)+1);
+  for (;;) {
+    Attr* attr = qs_parse_attr(doc,sp, ll, &next_point);
+    if (attr == NULL) {
+      QX_LOGGER_DEBUG("End of QS_PARSE_ATTR()");
+      break;
+    }
+    QX_LOGGER_DEBUG(attr->name);
+    QX_LOGGER_DEBUG(attr->value);
+    sp += next_point;
+    ll -= next_point;
+    QX_LOGGER_DEBUG_INT(sp, ll);
+    node = (Node*)qs_add_attr(doc,node, attr);
+  }
+
+  QX_LOGGER_DEBUG("end parse_tag()");
+  return node;
+}
+
+
+
+
+static char* 
+s_get_tag_name(Doc* doc, const char* s, int len)  {
+  int ii;
+  int sp;
+  int size;
+  char* return_value = NULL;
+
+  /* ignore space. */
+  for (ii = 0; ii < len; ii++) {
+    if (is_white_space(s[ii])) {
+      continue;
+    }
+    break;
+  }
+  sp = ii;
+  for (;ii<len; ii++) {
+    if (is_white_space(s[ii])) {
+      break;
+    }
+  }
+
+  size = ii-sp;
+
+  return_value = (char*)qs_malloc(doc, size+1,QX_LOGMARK);
+
+  memset(return_value, 0, size+1);
+  memcpy(return_value, &s[sp], size);
+
+  QX_LOGGER_DEBUG(return_value);
+  return return_value;
+}
+
+
+
+QS_EXPORT Node*
+qs_new_tag(Doc* doc) {
+  Node* node      = (Node*)qs_malloc(doc, sizeof(Node), QX_LOGMARK);
+  node->next      = NULL;
+  node->parent    = NULL;
+  node->child     = NULL;
+  node->child_tail= NULL;
+  node->attr      = NULL;
+  node->attr_tail = NULL;
+  node->name      = NULL;
+  node->value     = NULL;
+
+  return node;
+}
+
+
+
+
+QS_EXPORT Node*
+qs_add_attr(Doc* doc, Node* node, Attr* attr) {
+  if (node == NULL) 
+  {
+    QX_LOGGER_FATAL("qs_add_attr() node is null");
+  }
+
+  attr->parent = node;
+  attr->next   = NULL;
+  if (node->attr == NULL) 
+  {
+    node->attr      = attr;
+    node->attr_tail = attr;
+    return node;
+  }
+
+  node->attr_tail->next = attr;
+  node->attr_tail       = attr;
+  return node;
+}
+/*
+ * vim:ts=2 et
+ */
diff --git a/src/qs_parse_tag.h b/src/qs_parse_tag.h
new file mode 100644 (file)
index 0000000..2a1fa07
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005 QSDN,Inc. All rights reserved.
+ * Copyright (C) 2005 Atsushi Konno All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __QS_PARSE_TAG_H__
+#define __QS_PARSE_TAG_H__
+#include "qs_parse_string.h"
+
+QS_EXPORT Node* qs_parse_tag(Doc* doc, const char* s, int len) ;
+QS_EXPORT Node* qs_new_tag(Doc* doc);
+QS_EXPORT Node* qs_add_attr(Doc* doc, Node* node, Attr* attr);
+#endif
+/*
+ * vim:ts=2 et
+ */
+