OSDN Git Service

* warning
[modchxj/mod_chxj.git] / src / chxj_jxhtml.c
old mode 100644 (file)
new mode 100755 (executable)
index 14a6fff..afe049b
@@ -24,6 +24,7 @@
 #include "chxj_str_util.h"
 #include "chxj_header_inf.h"
 #include "chxj_jreserved_tag.h"
+#include "chxj_conv_z2h.h"
 
 
 #define GET_JXHTML(X) ((jxhtml_t *)(X))
@@ -61,8 +62,18 @@ static char *s_jxhtml_start_li_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_end_li_tag         (void *pdoc, Node *node);
 static char *s_jxhtml_start_br_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_end_br_tag         (void *pdoc, Node *node);
+
+static char *s_jxhtml_start_table_tag    (void *pdoc, Node *node);
+static char *s_jxhtml_end_table_tag      (void *pdoc, Node *node);
 static char *s_jxhtml_start_tr_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_end_tr_tag         (void *pdoc, Node *node);
+static char *s_jxhtml_start_td_or_th_tag       (void *pdoc, Node *node,char *tagName);
+static char *s_jxhtml_end_td_or_th_tag         (void *pdoc, Node *node,char *tagName);
+static char *s_jxhtml_start_td_tag       (void *pdoc, Node *node);
+static char *s_jxhtml_end_td_tag         (void *pdoc, Node *node);
+static char *s_jxhtml_start_th_tag       (void *pdoc, Node *node);
+static char *s_jxhtml_end_th_tag         (void *pdoc, Node *node);
+
 static char *s_jxhtml_start_font_tag     (void *pdoc, Node *node);
 static char *s_jxhtml_end_font_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_start_form_tag     (void *pdoc, Node *node);
@@ -123,6 +134,9 @@ static char *s_jxhtml_link_tag           (void *pdoc, Node *node);
 static char *s_jxhtml_start_span_tag     (void *pdoc, Node *node);
 static char *s_jxhtml_end_span_tag       (void *pdoc, Node *node);
 static char *s_jxhtml_style_tag       (void *pdoc, Node *node);
+static char *s_jxhtml_start_object_tag     (void *pdoc, Node *node);
+static char *s_jxhtml_end_object_tag       (void *pdoc, Node *node);
+static char *s_jxhtml_start_param_tag     (void *pdoc, Node *node);
 
 static void  s_init_jxhtml(jxhtml_t *jxhtml, Doc *doc, request_rec *r, device_table *spec);
 
@@ -236,8 +250,8 @@ tag_handler jxhtml_handler[] = {
   },
   /* tagTABLE */
   {
-    NULL,
-    NULL,
+    s_jxhtml_start_table_tag,
+    s_jxhtml_end_table_tag,
   },
   /* tagTR */
   {
@@ -246,8 +260,8 @@ tag_handler jxhtml_handler[] = {
   },
   /* tagTD */
   {
-    NULL,
-    NULL,
+    s_jxhtml_start_td_tag,
+    s_jxhtml_end_td_tag,
   },
   /* tagTBODY */
   {
@@ -304,6 +318,11 @@ tag_handler jxhtml_handler[] = {
     s_jxhtml_chxjif_tag,
     NULL,
   },
+  /* tagCHXJRAW */
+  {
+    s_jxhtml_chxjif_tag,
+    NULL,
+  },
   /* tagNOBR */
   {
     NULL,
@@ -331,8 +350,8 @@ tag_handler jxhtml_handler[] = {
   },
   /* tagTH */
   {
-    NULL,
-    NULL,
+    s_jxhtml_start_th_tag,
+    s_jxhtml_end_th_tag,
   },
   /* tagB */
   {
@@ -409,6 +428,16 @@ tag_handler jxhtml_handler[] = {
     s_jxhtml_newline_mark,
     NULL,
   },
+  /* tagObject */
+  {
+    s_jxhtml_start_object_tag,
+    s_jxhtml_end_object_tag,
+  },
+  /* tagParam */
+  {
+    s_jxhtml_start_param_tag,
+    NULL,
+  },
 };
 
 
@@ -483,7 +512,7 @@ chxj_convert_jxhtml(
 
   chxj_buffered_write_init(r->pool, &doc.buf);
   /*--------------------------------------------------------------------------*/
-  /* It converts it from CHTML to JXHTML.                                      */
+  /* It converts it from CHTML to JXHTML.                                     */
   /*--------------------------------------------------------------------------*/
   chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
   jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
@@ -617,7 +646,7 @@ chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char
   jxhtml = &__jxhtml;
   doc    = &__doc;
 
-  DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
+  DBG(r, "REQ[%X] start chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
   memset(doc,    0, sizeof(Doc));
   memset(jxhtml, 0, sizeof(jxhtml_t));
 
@@ -658,7 +687,7 @@ chxj_jxhtml_emoji_only_converter(request_rec *r, device_table *spec, const char
   }
   jxhtml->out = chxj_buffered_write_flush(jxhtml->out, &doc->buf);
 
-  DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (apr_size_t)(unsigned int)r);
+  DBG(r, "REQ[%X] end chxj_jxhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
   return jxhtml->out;
 }
 
@@ -682,7 +711,7 @@ s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
   jxhtml  = GET_JXHTML(pdoc);
   doc    = jxhtml->doc;
   r      = doc->r;
-  DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", (unsigned int)(apr_size_t)r);
+  DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
 
   W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
   W_NLCODE();
@@ -696,7 +725,7 @@ s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
 
   jxhtml->start_html_flag = 1;
 
-  DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", (unsigned int)(apr_size_t)r);
+  DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
 
   return jxhtml->out;
 }
@@ -819,7 +848,14 @@ s_jxhtml_start_meta_tag(void *pdoc, Node *node)
         }
       }
       break;
-    
+    case 'n':
+    case 'N':
+      if (strcasecmp(name, "name") == 0 && value && *value) {
+        W_L(" name=\"");
+        W_V(value);
+        W_L("\"");
+      }
+      break;
     default:
       break;
     }
@@ -1016,7 +1052,9 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
   char        *attr_bgcolor = NULL;
   char        *attr_text    = NULL;
   char        *attr_link    = NULL;
+  char        *attr_vlink   = NULL;
   char        *attr_style   = NULL;
+  char        *attr_background   = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -1058,7 +1096,13 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
       /*----------------------------------------------------------------------*/
       /* CHTML 4.0                                                            */
       /*----------------------------------------------------------------------*/
-      /* ignore */
+      attr_vlink = value;
+    }
+    else if (STRCASEEQ('b','B',"background",name) && value && *value) {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 6.0                                                            */
+      /*----------------------------------------------------------------------*/
+      attr_background = value;
     }
     else if (STRCASEEQ('s','S',"style",name) && value && *value) {
       attr_style = value;
@@ -1070,6 +1114,7 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
     if (style) {
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
       css_property_t *bgcolor_prop    = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *bgimage_prop    = chxj_css_get_property_value(doc, style, "background-image");
       css_property_t *cur;
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         if (cur->value && *cur->value) {
@@ -1081,6 +1126,18 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
           attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
         }
       }
+      for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          char *tmp = apr_pstrdup(doc->pool, cur->value);
+          char *tmps = strstr(tmp,"(");
+          if(tmps){
+            char *tmpe = strstr(tmp,")");
+            size_t len = strlen(tmps) - strlen(tmpe) -1 ;
+            tmps++;
+            attr_background = apr_pstrndup(doc->pool, tmps,len);
+          }
+        }
+      }
     }
     if (jxhtml->style) {
       css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, jxhtml->style);
@@ -1094,6 +1151,14 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
             }
           }
         }
+        else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
+          css_property_t *cur;
+          for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
+            if (cur->name && strcasecmp(cur->name, "color") == 0) {
+              attr_vlink = apr_pstrdup(doc->pool, cur->value);
+            }
+          }
+        }
       }
     }
   }
@@ -1122,6 +1187,17 @@ s_jxhtml_start_body_tag(void *pdoc, Node *node)
     W_V(attr_link);
     W_L("\"");
   }
+  if (attr_vlink) {
+    attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
+    W_L(" vlink=\"");
+    W_V(attr_vlink);
+    W_L("\"");
+  }
+  if (attr_background) {
+    W_L(" background=\"");
+    W_V(attr_background);
+    W_L("\"");
+  }
   W_L("><div>");
   return jxhtml->out;
 }
@@ -1170,6 +1246,7 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node)
   request_rec *r;
   Attr        *attr;
   char        *attr_style = NULL;
+  char        *attr_id    = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -1184,13 +1261,11 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node)
        attr = qs_get_next_attr(doc,attr)) {
     char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
-    if (STRCASEEQ('n','N',"name",name)) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML1.0                                                             */
-      /*----------------------------------------------------------------------*/
-      W_L(" name=\"");
-      W_V(chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp));
-      W_L("\"");
+    if (STRCASEEQ('i','I',"id",name)){
+      attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
+    }
+    else if (STRCASEEQ('n','N',"name",name)) {
+      attr_id = chxj_jreserved_to_safe_tag(r, value, jxhtml->entryp);
     }
     else if (STRCASEEQ('h','H',"href",name)) {
       /*----------------------------------------------------------------------*/
@@ -1282,6 +1357,11 @@ s_jxhtml_start_a_tag(void *pdoc, Node *node)
       attr_style = value;
     }
   }
+  if(attr_id){
+    W_L(" name=\"");
+    W_V(attr_id);
+    W_L("\"");
+  }
   W_L(">");
 
   if (IS_CSS_ON(jxhtml->entryp)) {
@@ -1340,8 +1420,10 @@ s_jxhtml_start_br_tag(void *pdoc, Node *node)
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
   r     = doc->r;
+  
+  char         *attr_style = NULL;
+  char         *attr_clear = NULL;
 
-  W_L("<br");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -1352,12 +1434,37 @@ s_jxhtml_start_br_tag(void *pdoc, Node *node)
     char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('c','C',"clear",name)) {
       if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
-        W_L(" clear=\"");
-        W_V(value);
-        W_L("\"");
+        attr_clear = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name)) {
+      attr_style = apr_pstrdup(doc->buf.pool, value);
+    }
+  }
+  if (IS_CSS_ON(jxhtml->entryp)) {
+    css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
+      css_property_t *cur;
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if ( STRCASEEQ('l','L',"left",  cur->value)
+            || STRCASEEQ('r','R',"right", cur->value)) {
+            attr_clear = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if(STRCASEEQ('b','B',"both"  ,cur->value)) {
+            attr_clear = apr_pstrdup(doc->pool, "all");
+          }
+        }
       }
     }
   }
+  W_L("<br");
+  if(attr_clear){
+    W_L(" clear=\"");
+    W_V(attr_clear);
+    W_L("\"");
+  }
   W_L(" />");
   return jxhtml->out;
 }
@@ -1378,6 +1485,194 @@ s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
   return jxhtml->out;
 }
 
+/**
+ * It is a handler who processes the TABLE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_start_table_tag(void *pdoc, Node *node) 
+{
+  jxhtml_t     *jxhtml;
+  Doc          *doc;
+  request_rec  *r;
+  Attr         *attr;
+  
+  char         *attr_style  = NULL;
+  char         *attr_align  = NULL;
+  char         *attr_width  = NULL;
+  char         *attr_height = NULL;
+  char         *attr_bgcolor = NULL;
+  char         *attr_border_width  = NULL;
+  char         *attr_border_color  = NULL;
+
+  jxhtml = GET_JXHTML(pdoc);
+  doc   = jxhtml->doc;
+  r     = doc->r;
+  
+  /*--------------------------------------------------------------------------*/
+  /* 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 *val   = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('a','A',"align",name)) {
+      if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
+        attr_align = apr_pstrdup(doc->buf.pool, val);
+      }
+    }
+    else if (STRCASEEQ('h','H',"height",name) && val && *val) {
+      attr_height = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('w','W',"width",name) && val && *val) {
+      attr_width = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('s','S',"style",name) && val && *val) {
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
+      attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
+      attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+    }
+    else if (STRCASEEQ('b','B',"border",name) && val && *val) {
+      attr_border_width = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
+      attr_border_color = apr_pstrdup(doc->buf.pool, val);
+      attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
+    }
+  }
+  
+  if (IS_CSS_ON(jxhtml->entryp)) {
+    css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *width_prop             = chxj_css_get_property_value(doc, style, "width");
+      css_property_t *height_prop            = chxj_css_get_property_value(doc, style, "height");
+      css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *border_width_prop      = chxj_css_get_property_value(doc, style, "border-width");
+      css_property_t *border_color_prop      = chxj_css_get_property_value(doc, style, "border-color");
+      
+      css_property_t *cur;
+      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp, "px");
+        if (tmpp) {
+          size_t len = strlen(tmp) - strlen(tmpp);
+          attr_width = apr_pstrndup(doc->pool, tmp,len);
+        }
+        else{
+          attr_width = apr_pstrdup(doc->pool, tmp);
+        }
+      }
+      for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp, "px");
+        if (tmpp) {
+          size_t len = strlen(tmp) - strlen(tmpp);
+          attr_height = apr_pstrndup(doc->pool, tmp,len);
+        }
+        else{
+          attr_height = apr_pstrdup(doc->pool, tmp);
+        }
+      }
+      for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
+        if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
+          attr_align = apr_pstrdup(doc->buf.pool, cur->value);
+        }
+      }
+      for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
+        attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+      }
+      for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp, "px");
+        if (tmpp) {
+          size_t len = strlen(tmp) - strlen(tmpp);
+          attr_border_width = apr_pstrndup(doc->pool, tmp,len);
+        }
+        else{
+          attr_border_width = apr_pstrdup(doc->pool, tmp);
+        }
+      }
+      for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
+        attr_border_color = apr_pstrdup(doc->pool, cur->value);
+        attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
+      }
+    }
+  }
+
+  W_L("<table");
+  if (attr_align){
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  if (attr_height){
+    W_L(" height=\"");
+    W_L(attr_height);
+    W_L("\"");
+  }
+  if (attr_width){
+    W_L(" width=\"");
+    W_V(attr_width);
+    W_L("\"");
+  }
+  if (attr_bgcolor && *attr_bgcolor){
+    W_L(" bgcolor=\"");
+    W_V(attr_bgcolor);
+    W_L("\"");
+  }
+  if (attr_border_width || attr_border_color ){
+    W_L(" style=\"border:");
+    if (attr_border_width){
+      W_V(attr_border_width);
+    }
+    else{
+      W_L("1");
+    }
+    W_L("px solid");
+    
+    if (attr_border_color && *attr_border_color){
+      W_L(" ");
+      W_V(attr_border_color);
+    }
+    W_L(";\"");
+  }
+  W_L(">");
+  
+  return jxhtml->out;
+}
+
+/**
+ * It is a handler who processes the TABLE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_end_table_tag(void *pdoc, Node *UNUSED(node)) 
+{
+  jxhtml_t      *jxhtml;
+  request_rec  *r;
+  Doc          *doc;
+
+  jxhtml = GET_JXHTML(pdoc);
+  doc   = jxhtml->doc;
+  r     = jxhtml->doc->r;
+  
+  W_L("</table>");
+  return jxhtml->out;
+}
+
 
 /**
  * It is a handler who processes the TR tag.
@@ -1388,17 +1683,92 @@ s_jxhtml_end_br_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_jxhtml_start_tr_tag(void *pdoc, Node *UNUSED(node)
+s_jxhtml_start_tr_tag(void *pdoc, Node *node
 {
   jxhtml_t      *jxhtml;
   Doc          *doc;
   request_rec  *r;
+  
+  Attr         *attr;
+  
+  char         *attr_style  = NULL;
+  char         *attr_align  = NULL;
+  char         *attr_valign = NULL;
+  char         *attr_bgcolor = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
   r     = doc->r;
+  
+  /*--------------------------------------------------------------------------*/
+  /* 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 *val   = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('a','A',"align",name)) {
+      if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
+        attr_align = apr_pstrdup(doc->buf.pool, val);
+      }
+    }
+    else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
+      if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
+        attr_valign = apr_pstrdup(doc->buf.pool, val);
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && val && *val) {
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
+      attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
+      attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+    }
+  }
+  
+  if (IS_CSS_ON(jxhtml->entryp)) {
+    css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *valign_prop            = chxj_css_get_property_value(doc, style, "vertical-align");
+      css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
+      
+      css_property_t *cur;
+      for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
+        if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
+          attr_align = apr_pstrdup(doc->buf.pool, cur->value);
+        }
+      }
+      for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+        if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
+          attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
+        }
+      }
+      for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
+        attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+      }
+    }
+  }
 
-  W_L("<br />");
+  W_L("<tr");
+  if (attr_align){
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  if (attr_valign){
+    W_L(" valign=\"");
+    W_V(attr_valign);
+    W_L("\"");
+  }
+  if (attr_bgcolor && *attr_bgcolor){
+    W_L(" bgcolor=\"");
+    W_V(attr_bgcolor);
+    W_L("\"");
+  }
+  W_L(">");
   return jxhtml->out;
 }
 
@@ -1414,10 +1784,256 @@ s_jxhtml_start_tr_tag(void *pdoc, Node *UNUSED(node))
 static char *
 s_jxhtml_end_tr_tag(void *pdoc, Node *UNUSED(child)) 
 {
-  jxhtml_t *jxhtml = GET_JXHTML(pdoc);
+  jxhtml_t      *jxhtml;
+  request_rec  *r;
+  Doc          *doc;
+
+  jxhtml = GET_JXHTML(pdoc);
+  doc   = jxhtml->doc;
+  r     = jxhtml->doc->r;
+  
+  W_L("</tr>");
+  return jxhtml->out;
+}
+
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_start_td_or_th_tag(void *pdoc, Node *node,char *tagName) 
+{
+  jxhtml_t      *jxhtml;
+  Doc          *doc;
+  request_rec  *r;
+
+  Attr         *attr;
+  
+  char         *attr_style  = NULL;
+  char         *attr_align  = NULL;
+  char         *attr_valign = NULL;
+  char         *attr_bgcolor = NULL;
+  char         *attr_colspan = NULL;
+  char         *attr_rowspan = NULL;
+  char         *attr_width   = NULL;
+  char         *attr_height  = NULL;
+
+  jxhtml = GET_JXHTML(pdoc);
+  doc   = jxhtml->doc;
+  r     = doc->r;
+  
+  /*--------------------------------------------------------------------------*/
+  /* 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 *val   = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('a','A',"align",name)) {
+      if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
+        attr_align = apr_pstrdup(doc->buf.pool, val);
+      }
+    }
+    else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
+      if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
+        attr_valign = apr_pstrdup(doc->buf.pool, val);
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && val && *val) {
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
+      attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
+      attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+    }
+    else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
+      attr_colspan = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
+      attr_rowspan = apr_pstrdup(doc->buf.pool, val);
+    }
+    else if (STRCASEEQ('w','W',"width",name) && val && *val) {
+      char *tmp = strstr(val, "%");
+      if(tmp){
+        attr_width = apr_pstrdup(doc->buf.pool, val);
+      }
+      else{
+        attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
+      }
+    }
+    else if (STRCASEEQ('h','H',"height",name) && val && *val) {
+      char *tmp = strstr(val, "%");
+      if(tmp){
+        attr_height = apr_pstrdup(doc->buf.pool, val);
+      }
+      else{
+        attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
+      }
+    }
+  }
+  
+  if (IS_CSS_ON(jxhtml->entryp)) {
+    css_prop_list_t *style = s_jxhtml_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *align_prop             = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *valign_prop            = chxj_css_get_property_value(doc, style, "vertical-align");
+      css_property_t *bgcolor_prop           = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *width_prop             = chxj_css_get_property_value(doc, style, "width");
+      css_property_t *height_prop            = chxj_css_get_property_value(doc, style, "height");
+      
+      css_property_t *cur;
+      for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
+        if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
+          attr_align = apr_pstrdup(doc->buf.pool, cur->value);
+        }
+      }
+      for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+        if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
+          attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
+        }
+      }
+      for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
+        attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+      }
+      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+        attr_width = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
+        attr_height = apr_pstrdup(doc->pool, cur->value);
+      }
+    }
+  }
+
+  W_L("<");
+  W_V(tagName);
+  if (attr_align){
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  if (attr_valign){
+    W_L(" valign=\"");
+    W_V(attr_valign);
+    W_L("\"");
+  }
+  if (attr_colspan){
+    W_L(" colspan=\"");
+    W_V(attr_colspan);
+    W_L("\"");
+  }
+  if (attr_rowspan){
+    W_L(" rowspan=\"");
+    W_V(attr_rowspan);
+    W_L("\"");
+  }
+  if (attr_bgcolor && *attr_bgcolor){
+    W_L(" bgcolor=\"");
+    W_V(attr_bgcolor);
+    W_L("\"");
+  }
+  if (attr_width || attr_height ){
+    W_L(" style=\"");
+    if (attr_width){
+      W_L("width:");
+      W_V(attr_width);
+      W_L(";");
+    }
+    if (attr_height){
+      W_L("height:");
+      W_V(attr_height);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
+  return jxhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TR tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName) 
+{
+  jxhtml_t      *jxhtml;
+  request_rec  *r;
+  Doc          *doc;
+
+  jxhtml = GET_JXHTML(pdoc);
+  doc   = jxhtml->doc;
+  r     = jxhtml->doc->r;
+  
+  W_L("</");
+  W_V(tagName);
+  W_L(">");
   return jxhtml->out;
 }
 
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_start_td_tag(void *pdoc, Node *node) 
+{
+  return s_jxhtml_start_td_or_th_tag(pdoc,node,"td");
+}
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_end_td_tag(void *pdoc, Node *node) 
+{
+  return s_jxhtml_end_td_or_th_tag(pdoc,node,"td");
+}
+
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_start_th_tag(void *pdoc, Node *node) 
+{
+  return s_jxhtml_start_td_or_th_tag(pdoc,node,"th");
+}
+/**
+ * It is a handler who processes the TD tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JXHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The TD tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_end_th_tag(void *pdoc, Node *node) 
+{
+  return s_jxhtml_end_td_or_th_tag(pdoc,node,"th");
+}
 
 /**
  * It is a handler who processes the FONT tag.
@@ -1618,6 +2234,7 @@ s_jxhtml_start_form_tag(void *pdoc, Node *node)
   char        *attr_color  = NULL;
   char        *attr_align  = NULL;
   char        *attr_name   = NULL;
+  char        *css_clear   = NULL;
   char        *new_hidden_tag = NULL;
 
   jxhtml  = GET_JXHTML(pdoc);
@@ -1679,6 +2296,7 @@ s_jxhtml_start_form_tag(void *pdoc, Node *node)
     if (style) {
       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *clear_prop      = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -1694,6 +2312,9 @@ s_jxhtml_start_form_tag(void *pdoc, Node *node)
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         attr_color = apr_pstrdup(doc->pool, cur->value);
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
 
@@ -1730,6 +2351,12 @@ s_jxhtml_start_form_tag(void *pdoc, Node *node)
     W_V(attr_name);
     W_L("\"");
   }
+  if (css_clear) {
+    W_L(" style=\"");
+    W_L("clear:");
+    W_V(css_clear);
+    W_L("\"");
+  }
   W_L(">");
 
   jxhtml_flags_t *flg = (jxhtml_flags_t *)apr_palloc(doc->pool, sizeof(jxhtml_flags_t));
@@ -1909,29 +2536,12 @@ s_jxhtml_start_input_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
-    /*------------------------------------------------------------------------*/
-    /* CHTML 2.0                                                              */
-    /*------------------------------------------------------------------------*/
-    if (attr_type && STRCASEEQ('p','P',"password", attr_type) && ! jxhtml->entryp->pc_flag ) {
-      char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
-      W_L(" style=\"-wap-input-format:&quot;*");
-      W_V(vv);
-      W_L("&quot;;\"");
-    }
-    else {
-      char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
-      W_L(" style=\"");
-      W_L("-wap-input-format:&quot;*");
-      W_V(vv);
-      W_L("&quot;;");
-      W_L("\"");
-    }
+    W_L(" istyle=\"");
+    W_V(attr_istyle);
+    W_L("\"");
   }
-  else if (attr_type && STRCASEEQ('p','P',"password",attr_type)) {
-    char *vv = qs_conv_istyle_to_format(doc->buf.pool, "4");
-    W_L(" style=\"-wap-input-format:&quot;*");
-    W_V(vv);
-    W_L("&quot;;\"");
+  else if(attr_type && STRCASEEQ('p','P',"password",attr_type)) {
+    W_L(" istyle=\"4\"");
   }
   /*--------------------------------------------------------------------------*/
   /* The figure is default for the password.                                  */
@@ -2009,6 +2619,11 @@ s_jxhtml_start_input_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   if (value && *value) {
+    if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
+      apr_size_t value_len = strlen(value);
+      value = chxj_conv_z2h(r, value, &value_len, jxhtml->entryp);
+    }
+
     W_L(" value=\"");
     W_V(chxj_add_slash_to_doublequote(doc->pool, value));
     W_L("\"");
@@ -2428,6 +3043,7 @@ s_jxhtml_start_p_tag(void *pdoc, Node *node)
   char        *attr_style = NULL;
   char        *attr_color = NULL;
   char        *attr_blink = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -2457,6 +3073,7 @@ s_jxhtml_start_p_tag(void *pdoc, Node *node)
       css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
       css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
       css_property_t *text_deco_prop  = chxj_css_get_property_value(doc, style, "text-decoration");
+      css_property_t *clear_prop      = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left",cur->value)) {
@@ -2479,10 +3096,13 @@ s_jxhtml_start_p_tag(void *pdoc, Node *node)
           attr_blink = apr_pstrdup(doc->pool, cur->value);
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
   W_L("<p");
-  if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
+  if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
     W_L(" style=\"");
     if (attr_align) {
       W_L("text-align:");
@@ -2500,6 +3120,11 @@ s_jxhtml_start_p_tag(void *pdoc, Node *node)
       W_V(attr_blink);
       W_L(";");
     }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -2696,6 +3321,9 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
   char        *attr_noshade = NULL;
   char        *attr_style   = NULL;
   char        *attr_color   = NULL;
+  
+  char        *style_float  = NULL;
+  char        *style_border_color = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -2778,7 +3406,12 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
       css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
       css_property_t *height_prop       = chxj_css_get_property_value(doc, style, "height");
       css_property_t *width_prop        = chxj_css_get_property_value(doc, style, "width");
+      
+      css_property_t *bgcolor_prop      = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *float_prop        = chxj_css_get_property_value(doc, style, "float");
+      css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
       css_property_t *cur;
+      
       for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
         if (STRCASEEQ('s','S',"solid",cur->value)) {
           attr_noshade = "noshade";
@@ -2791,6 +3424,24 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
           attr_size = apr_pstrdup(doc->pool, tmp);
         }
       }
+      if(!attr_color){
+          for(cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next){
+          char *tmp   = apr_pstrdup(doc->pool,cur->value);
+          attr_color  = apr_pstrdup(doc->pool,tmp);
+        }
+      }
+      for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp,"none");
+        if(tmpp){
+          style_float = "center";
+        }
+        else{
+          style_float = apr_pstrdup(doc->pool,tmp);
+        }
+      }
+      
+      
       for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
         char *tmp = apr_pstrdup(doc->pool, cur->value);
         char *tmpp = strstr(tmp, "px");
@@ -2804,6 +3455,13 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
           }
         }
       }
+      
+      for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        if(tmp){
+          style_border_color = apr_pstrdup(doc->pool, tmp);
+        }
+      }
     }
   }
   W_L("<hr");
@@ -2812,7 +3470,14 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
     W_V(attr_align);
     W_L("\"");
   }
-  if (attr_size || attr_width || attr_noshade) {
+  else{
+    if(style_float){
+      W_L(" align=\"");
+      W_V(style_float);
+      W_L("\"");
+    }
+  }
+  if (attr_size || attr_width || attr_noshade || style_border_color) {
     W_L(" style=\"");
     if (attr_size) {
       W_L("height:");
@@ -2833,6 +3498,11 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
     if (attr_noshade) {
       W_L("border-style:solid;");
     }
+    if(style_border_color){
+      W_L("border-color:");
+      W_V(style_border_color);
+      W_V(";");
+    }
     W_L("\"");
   }
   if (attr_color) {
@@ -2840,6 +3510,7 @@ s_jxhtml_start_hr_tag(void *pdoc, Node *node)
     W_V(attr_color);
     W_L("\"");
   }
+  
   W_L(" />");
 
   return jxhtml->out;
@@ -2883,6 +3554,17 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node)
   char        *attr_align  = NULL;
   char        *attr_alt    = NULL;
   char        *attr_style  = NULL;
+  char        *attr_hspace = NULL;
+  char        *attr_vspace = NULL;
+  
+  char        *css_float          = NULL;
+  char        *css_margin_left    = NULL;
+  char        *css_margin_right   = NULL;
+  char        *css_margin_top     = NULL;
+  char        *css_margin_bottom  = NULL;
+  char        *css_display        = NULL;
+  char        *css_valign         = NULL;
+  
 #ifndef IMG_NOT_CONVERT_FILENAME
   device_table  *spec = jxhtml->spec;
 #endif
@@ -2919,13 +3601,13 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node)
       if (value) {
         if (STRCASEEQ('t','T',"top",   value) ||
             STRCASEEQ('m','M',"middle",value) ||
-            STRCASEEQ('b','B',"bottom",value) ||
-            STRCASEEQ('l','L',"left",  value) ||
-            STRCASEEQ('r','R',"right", value)) {
-          attr_align = value;
+            STRCASEEQ('b','B',"bottom",value)){
+          css_valign = value;
+        }else if (STRCASEEQ('l','L',"left",  value) || STRCASEEQ('r','R',"right", value)) {
+          css_float = value;
         }
         else if (STRCASEEQ('c','C',"center",value)) {
-          attr_align = apr_pstrdup(doc->pool, "middle");
+          css_valign = apr_pstrdup(doc->pool, "middle");
         }
       }
     }
@@ -2945,13 +3627,13 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node)
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      /* ignore */
+      attr_hspace = value;
     }
     else if (STRCASEEQ('v','V',"vspace",name)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0                                                            */
       /*----------------------------------------------------------------------*/
-      /* ignore */
+      attr_vspace = value;
     }
     else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
       /*----------------------------------------------------------------------*/
@@ -2973,30 +3655,122 @@ s_jxhtml_start_img_tag(void *pdoc, Node *node)
       css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
       css_property_t *width_prop  = chxj_css_get_property_value(doc, style, "width");
       css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
+      css_property_t *margin_left_prop   = chxj_css_get_property_value(doc, style, "margin-left");
+      css_property_t *margin_right_prop  = chxj_css_get_property_value(doc, style, "margin-right");
+      css_property_t *margin_top_prop    = chxj_css_get_property_value(doc, style, "margin-top");
+      css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
+      
+      
       css_property_t *cur;
       for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
         attr_height = apr_pstrdup(doc->pool, cur->value);
       }
-      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
-        attr_width = apr_pstrdup(doc->pool, cur->value);
+      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+        attr_width = apr_pstrdup(doc->pool, cur->value);
+      }
+      if(!css_valign){
+        for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+          css_valign = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      if (! attr_hspace) {
+        for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
+          css_margin_left   = apr_pstrdup(doc->pool, cur->value);
+        }
+        for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
+          css_margin_right  = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      if (! attr_vspace) {
+        for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
+          css_margin_top = apr_pstrdup(doc->pool, cur->value);
+        }
+        for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
+          css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      if(!css_float){
+        css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
+        for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
+          css_float = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      
+      css_property_t *display_prop       = chxj_css_get_property_value(doc, style, "display");
+      for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp, "none");
+        if(tmpp){
+          css_display = apr_pstrdup(doc->pool, tmp);
+        }
+      }
+    }
+  }
+
+  W_L("<img");
+  if (attr_src) {
+    W_L(" src=\"");
+    W_V(attr_src);
+    W_L("\"");
+  }
+  if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
+    W_L(" style=\"");
+    if(css_float){
+      W_L("float:");
+      W_V(css_float);
+      W_L(";");
+    }
+    if(css_valign){
+      W_L("vertical-align:");
+      W_V(css_valign);
+      W_L(";");
+    }
+    if (attr_hspace) {
+      W_L("margin-left:");
+      W_V(attr_hspace);
+      W_L(";");
+      W_L("margin-right:");
+      W_V(attr_hspace);
+      W_L(";");
+    }
+    else{
+      if(css_margin_left){
+        W_L("margin-left:");
+        W_V(css_margin_left);
+        W_L(";");
+      }
+      if(css_margin_right){
+        W_L("margin-right:");
+        W_V(css_margin_right);
+        W_L(";");
+      }
+    }
+    if (attr_vspace) {
+      W_L("margin-top:");
+      W_V(attr_vspace);
+      W_L(";");
+      W_L("margin-bottom:");
+      W_V(attr_vspace);
+      W_L(";");
+    }
+    else{
+      if(css_margin_top){
+        W_L("margin-top:");
+        W_V(css_margin_top);
+        W_L(";");
       }
-      for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
-        attr_align = apr_pstrdup(doc->pool, cur->value);
+      if(css_margin_bottom){
+        W_L("margin-bottom:");
+        W_V(css_margin_bottom);
+        W_L(";");
       }
     }
-  }
-
-  W_L("<img");
-  if (attr_src) {
-    W_L(" src=\"");
-    W_V(attr_src);
-    W_L("\"");
-  }
-  if (attr_align) {
-    W_L(" align=\"");
-    W_V(attr_align); 
+    if(css_display){
+      W_L("display:none;");
+    }
     W_L("\"");
   }
+  
   if (attr_width) {
     W_L(" width=\"");
     W_V(attr_width);
@@ -3241,6 +4015,7 @@ s_jxhtml_start_div_tag(void *pdoc, Node *node)
   char        *attr_color             = NULL;
   char        *attr_bgcolor           = NULL;
   char        *attr_font_size         = NULL;
+  char        *css_clear              = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -3274,6 +4049,7 @@ s_jxhtml_start_div_tag(void *pdoc, Node *node)
       css_property_t *font_size_prop         = chxj_css_get_property_value(doc, style, "font-size");
       css_property_t *background_color_prop  = chxj_css_get_property_value(doc, style, "background-color");
       css_property_t *background_prop        = chxj_css_get_property_value(doc, style, "background");
+      css_property_t *clear_prop             = chxj_css_get_property_value(doc, style, "clear");
 
       css_property_t *cur;
       for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
@@ -3335,9 +4111,17 @@ s_jxhtml_start_div_tag(void *pdoc, Node *node)
           }
         }
         for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
-          attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+          if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
+            attr_wap_marquee_loop = "infinite";
+          }
+          else{
+            attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+          }
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        css_clear = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }  
   W_L("<div");
@@ -3349,7 +4133,8 @@ s_jxhtml_start_div_tag(void *pdoc, Node *node)
       || attr_wap_marquee_loop
       || attr_color
       || attr_bgcolor
-      || attr_font_size) {
+      || attr_font_size
+      || css_clear ) {
     W_L(" style=\"");
     if (attr_align) {
       W_L("text-align:");
@@ -3396,6 +4181,11 @@ s_jxhtml_start_div_tag(void *pdoc, Node *node)
       W_V(attr_font_size);
       W_L(";");
     }
+    if (css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -3547,11 +4337,8 @@ s_jxhtml_start_textarea_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   if (attr_istyle) {
-    char *vv = qs_conv_istyle_to_format(doc->buf.pool, attr_istyle);
-    W_L(" style=\"");
-    W_L("-wap-input-format:&quot;*");
-    W_V(vv);
-    W_L("&quot;;");
+    W_L(" istyle=\"");
+    W_V(attr_istyle);
     W_L("\"");
   }
   W_L(">");
@@ -3639,6 +4426,7 @@ s_jxhtml_text_tag(void* pdoc, Node* child)
   int          ii;
   int          tdst_len;
   request_rec* r;
+  apr_size_t   z2h_input_len;
 
   jxhtml = GET_JXHTML(pdoc);
   doc   = jxhtml->doc;
@@ -3689,6 +4477,9 @@ s_jxhtml_text_tag(void* pdoc, Node* child)
       }
     }
   }
+  z2h_input_len = strlen(tdst);
+  tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, jxhtml->entryp);
+
   W_V(tdst);
   return jxhtml->out;
 }
@@ -4261,6 +5052,7 @@ s_jxhtml_start_h1_tag(void *pdoc, Node *node)
   Attr        *attr;
   char        *attr_style = NULL;
   char        *attr_align = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc    = jxhtml->doc;
@@ -4284,6 +5076,7 @@ s_jxhtml_start_h1_tag(void *pdoc, Node *node)
     css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -4296,17 +5089,35 @@ s_jxhtml_start_h1_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"both", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "both");
+        }
+        else if (STRCASEEQ('r','R',"right", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "right");
+        }
+        else if (STRCASEEQ('l','L',"left", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "left");
+        }
+      }
     }
   }
-  W_L("<div");
-  W_L(" style=\""); 
-  W_L("font-size:xx-large;");
-  if (attr_align) {
-    W_L("text-align:");
-    W_V(attr_align);
-    W_L(";");
+  W_L("<h1");
+  if (attr_align || css_clear ) {
+    W_L(" style=\"");
+    if(attr_align){
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if(css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
+    W_L("\"");
   }
-  W_L("\">");
+  W_L(">");
 
   return jxhtml->out;
 }
@@ -4331,7 +5142,7 @@ s_jxhtml_end_h1_tag(void *pdoc, Node *UNUSED(child))
   doc     = jxhtml->doc;
   r       = doc->r;
   
-  W_L("</div>");
+  W_L("</h1>");
   if (IS_CSS_ON(jxhtml->entryp)) {
     chxj_css_pop_prop_list(jxhtml->css_prop_stack);
   }
@@ -4357,6 +5168,7 @@ s_jxhtml_start_h2_tag(void *pdoc, Node *node)
   Attr        *attr;
   char        *attr_style = NULL;
   char        *attr_align = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -4380,6 +5192,7 @@ s_jxhtml_start_h2_tag(void *pdoc, Node *node)
     css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -4392,17 +5205,35 @@ s_jxhtml_start_h2_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"both", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "both");
+        }
+        else if (STRCASEEQ('r','R',"right", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "right");
+        }
+        else if (STRCASEEQ('l','L',"left", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "left");
+        }
+      }
     }
   }
-  W_L("<div");
-  W_L(" style=\""); 
-  W_L("font-size:x-large;");
-  if (attr_align) {
-    W_L("text-align:");
-    W_V(attr_align);
-    W_L(";");
+  W_L("<h2");
+  if (attr_align || css_clear ) {
+    W_L(" style=\"");
+    if(attr_align){
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if(css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
+    W_L("\"");
   }
-  W_L("\">");
+  W_L(">");
 
   return jxhtml->out;
 }
@@ -4427,7 +5258,7 @@ s_jxhtml_end_h2_tag(void *pdoc, Node *UNUSED(child))
   doc     = jxhtml->doc;
   r       = doc->r;
   
-  W_L("</div>");
+  W_L("</h2>");
   if (IS_CSS_ON(jxhtml->entryp)) {
     chxj_css_pop_prop_list(jxhtml->css_prop_stack);
   }
@@ -4452,6 +5283,7 @@ s_jxhtml_start_h3_tag(void *pdoc, Node *node)
   Attr        *attr;
   char        *attr_style = NULL;
   char        *attr_align = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -4475,6 +5307,7 @@ s_jxhtml_start_h3_tag(void *pdoc, Node *node)
     css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -4487,17 +5320,35 @@ s_jxhtml_start_h3_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"both", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "both");
+        }
+        else if (STRCASEEQ('r','R',"right", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "right");
+        }
+        else if (STRCASEEQ('l','L',"left", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "left");
+        }
+      }
     }
   }
-  W_L("<div");
-  W_L(" style=\""); 
-  W_L("font-size:large;");
-  if (attr_align) {
-    W_L("text-align:");
-    W_V(attr_align);
-    W_L(";");
+  W_L("<h3");
+  if (attr_align || css_clear ) {
+    W_L(" style=\"");
+    if(attr_align){
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if(css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
+    W_L("\"");
   }
-  W_L("\">");
+  W_L(">");
 
   return jxhtml->out;
 }
@@ -4522,7 +5373,7 @@ s_jxhtml_end_h3_tag(void *pdoc, Node *UNUSED(child))
   doc     = jxhtml->doc;
   r       = doc->r;
 
-  W_L("</div>");
+  W_L("</h3>");
   if (IS_CSS_ON(jxhtml->entryp)) {
     chxj_css_pop_prop_list(jxhtml->css_prop_stack);
   }
@@ -4547,6 +5398,7 @@ s_jxhtml_start_h4_tag(void *pdoc, Node *node)
   Attr        *attr;
   char        *attr_style = NULL;
   char        *attr_align = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -4570,6 +5422,7 @@ s_jxhtml_start_h4_tag(void *pdoc, Node *node)
     css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -4582,17 +5435,35 @@ s_jxhtml_start_h4_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"both", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "both");
+        }
+        else if (STRCASEEQ('r','R',"right", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "right");
+        }
+        else if (STRCASEEQ('l','L',"left", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "left");
+        }
+      }
     }
   }
-  W_L("<div");
-  W_L(" style=\""); 
-  W_L("font-size:small;");
-  if (attr_align) {
-    W_L("text-align:");
-    W_V(attr_align);
-    W_L(";");
+  W_L("<h4");
+  if (attr_align || css_clear ) {
+    W_L(" style=\"");
+    if(attr_align){
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if(css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
+    W_L("\"");
   }
-  W_L("\">");
+  W_L(">");
 
   return jxhtml->out;
 }
@@ -4617,7 +5488,7 @@ s_jxhtml_end_h4_tag(void *pdoc, Node *UNUSED(child))
   doc     = jxhtml->doc;
   r       = doc->r;
   
-  W_L("</div>");
+  W_L("</h4>");
   if (IS_CSS_ON(jxhtml->entryp)) {
     chxj_css_pop_prop_list(jxhtml->css_prop_stack);
   }
@@ -4643,6 +5514,7 @@ s_jxhtml_start_h5_tag(void *pdoc, Node *node)
   Attr        *attr;
   char        *attr_style = NULL;
   char        *attr_align = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -4666,6 +5538,7 @@ s_jxhtml_start_h5_tag(void *pdoc, Node *node)
     css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -4678,17 +5551,35 @@ s_jxhtml_start_h5_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"both", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "both");
+        }
+        else if (STRCASEEQ('r','R',"right", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "right");
+        }
+        else if (STRCASEEQ('l','L',"left", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "left");
+        }
+      }
     }
   }
-  W_L("<div");
-  W_L(" style=\""); 
-  W_L("font-size:x-small;");
-  if (attr_align) {
-    W_L("text-align:");
-    W_V(attr_align);
-    W_L(";");
+  W_L("<h5");
+  if (attr_align || css_clear ) {
+    W_L(" style=\"");
+    if(attr_align){
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if(css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
+    W_L("\"");
   }
-  W_L("\">");
+  W_L(">");
 
   return jxhtml->out;
 }
@@ -4713,7 +5604,7 @@ s_jxhtml_end_h5_tag(void *pdoc, Node *UNUSED(child))
   doc     = jxhtml->doc;
   r       = doc->r;
   
-  W_L("</div>");
+  W_L("</h5>");
   if (IS_CSS_ON(jxhtml->entryp)) {
     chxj_css_pop_prop_list(jxhtml->css_prop_stack);
   }
@@ -4739,6 +5630,7 @@ s_jxhtml_start_h6_tag(void *pdoc, Node *node)
   Attr        *attr;
   char        *attr_style = NULL;
   char        *attr_align = NULL;
+  char        *css_clear  = NULL;
 
   jxhtml   = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -4762,6 +5654,7 @@ s_jxhtml_start_h6_tag(void *pdoc, Node *node)
     css_prop_list_t *style = s_jxhtml_push_and_get_now_style(pdoc, node, attr_style);
     if (style) {
       css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *clear_prop           = chxj_css_get_property_value(doc, style, "clear");
       css_property_t *cur;
       for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
         if (STRCASEEQ('l','L',"left", cur->value)) {
@@ -4774,17 +5667,35 @@ s_jxhtml_start_h6_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"both", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "both");
+        }
+        else if (STRCASEEQ('r','R',"right", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "right");
+        }
+        else if (STRCASEEQ('l','L',"left", cur->value)) {
+          css_clear = apr_pstrdup(doc->pool, "left");
+        }
+      }
     }
   }
-  W_L("<div");
-  W_L(" style=\""); 
-  W_L("font-size:xx-small;");
-  if (attr_align) {
-    W_L("text-align:");
-    W_V(attr_align);
-    W_L(";");
+  W_L("<h6");
+  if (attr_align || css_clear ) {
+    W_L(" style=\"");
+    if(attr_align){
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if(css_clear){
+      W_L("clear:");
+      W_V(css_clear);
+      W_L(";");
+    }
+    W_L("\"");
   }
-  W_L("\">");
+  W_L(">");
 
   return jxhtml->out;
 }
@@ -4809,7 +5720,7 @@ s_jxhtml_end_h6_tag(void *pdoc, Node *UNUSED(child))
   doc     = jxhtml->doc;
   r       = doc->r;
   
-  W_L("</div>");
+  W_L("</h6>");
   if (IS_CSS_ON(jxhtml->entryp)) {
     chxj_css_pop_prop_list(jxhtml->css_prop_stack);
   }
@@ -5400,6 +6311,7 @@ s_jxhtml_start_span_tag(void *pdoc, Node *node)
   char *attr_marquee_dir = NULL;
   char *attr_marquee_style = NULL;
   char *attr_marquee_loop = NULL;
+  char *css_bgcolor        = NULL;
 
   jxhtml = GET_JXHTML(pdoc);
   doc     = jxhtml->doc;
@@ -5424,6 +6336,8 @@ s_jxhtml_start_span_tag(void *pdoc, Node *node)
       css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
       css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
       css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+      css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
+      
       css_property_t *cur;
       for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
         attr_color = apr_pstrdup(doc->pool, cur->value);
@@ -5470,7 +6384,12 @@ s_jxhtml_start_span_tag(void *pdoc, Node *node)
       }
       for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
         if (cur->value && *cur->value) {
-          attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+          if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
+            attr_marquee_loop = "infinite";
+          }
+          else{
+            attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+          }
         }
       }
       for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
@@ -5484,11 +6403,16 @@ s_jxhtml_start_span_tag(void *pdoc, Node *node)
           attr_align = apr_pstrdup(doc->pool, "right");
         }
       }
+      for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          css_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
     }
   }
 
   W_L("<span");
-  if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
+  if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
     W_L(" style=\"");
     if (attr_color) {
       attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
@@ -5529,6 +6453,11 @@ s_jxhtml_start_span_tag(void *pdoc, Node *node)
         W_L(";");
       }
     }
+    if(css_bgcolor){
+      W_L("background-color:");
+      W_V(css_bgcolor);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -5605,6 +6534,183 @@ s_jxhtml_style_tag(void *pdoc, Node *node)
   }
   return jxhtml->out;
 }
+/**
+ * It is a handler who processes the OBJECT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OBJECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_start_object_tag(void *pdoc, Node *node)
+{
+  jxhtml_t *jxhtml = GET_JXHTML(pdoc);
+  Doc *doc = jxhtml->doc;
+  Attr *attr;
+  
+  char *attr_id            = NULL;
+  char *attr_width         = NULL;
+  char *attr_height        = NULL;
+  char *attr_data          = NULL;
+  char *attr_type          = NULL;
+  char *attr_declare       = NULL;
+  char *attr_classid       = NULL;
+  char *attr_codebase      = 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 (STRCASEEQ('i','I',"id",name)) {
+      attr_id = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('w','W',"width",name)) {
+      attr_width = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('h','H',"height",name)) {
+      attr_height = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('d','D',"data",name)) {
+      attr_data = apr_pstrdup(doc->pool, value);
+    }
+    else if  (STRCASEEQ('t','T',"type",name)) {
+      attr_type = apr_pstrdup(doc->pool, value);
+    }
+    else if  (STRCASEEQ('d','D',"declare",name)) {
+      attr_declare = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('c','C',"classid",name)) {
+      attr_classid = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('c','C',"codebase",name)) {
+      attr_codebase = apr_pstrdup(doc->pool, value);
+    }
+    
+  }
+  W_L("<object");
+  
+  if(attr_id){
+    W_L(" id=\"");
+    W_V(attr_id);
+    W_L("\"");
+  }
+  if(attr_width){
+    W_L(" width=\"");
+    W_V(attr_width);
+    W_L("\"");
+  }
+  if(attr_height){
+    W_L(" height=\"");
+    W_V(attr_height);
+    W_L("\"");
+  }
+  if(attr_data){
+    W_L(" data=\"");
+    W_V(attr_data);
+    W_L("\"");
+  }
+  if(attr_type){
+    W_L(" type=\"");
+    W_V(attr_type);
+    W_L("\"");
+  }
+  if(attr_declare){
+    W_L(" declare=\"declare\"");
+  }
+  if(attr_classid){
+    W_L(" classid=\"");
+    W_V(attr_classid);
+    W_L("\"");
+  }
+  if(attr_codebase){
+    W_L(" codebase=\"");
+    W_V(attr_codebase);
+    W_L("\"");
+  }
+  
+  W_L(">");
+  return jxhtml->out;
+}
+/**
+ * It is a handler who processes the OBJECT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OBJECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_end_object_tag(void *pdoc, Node *UNUSED(node))
+{
+  jxhtml_t *jxhtml = GET_JXHTML(pdoc);
+  Doc *doc = jxhtml->doc;
+
+  W_L("</object>");
+  return jxhtml->out;
+}
+/**
+ * It is a handler who processes the OBJECT tag.
+ *
+ * @param pdoc  [i/o] The pointer to the JHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The OBJECT tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_jxhtml_start_param_tag(void *pdoc, Node *node)
+{
+  jxhtml_t *jxhtml = GET_JXHTML(pdoc);
+  Doc *doc = jxhtml->doc;
+
+  Attr *attr;
+  char *attr_style         = NULL;
+  char *attr_name          = NULL;
+  char *attr_value         = NULL;
+  char *attr_valuetype     = 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 (STRCASEEQ('n','N',"name",name)) {
+      attr_name = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('v','V',"value",name)) {
+      attr_value = apr_pstrdup(doc->pool, value);
+    }
+    else if (STRCASEEQ('v','V',"valuetype",name)) {
+      attr_valuetype = apr_pstrdup(doc->pool, value);
+    }
+  }
+  W_L("<param");
+  
+  if(attr_name){
+    W_L(" name=\"");
+    W_V(attr_name);
+    W_L("\"");
+  }
+  if(attr_value){
+    W_L(" value=\"");
+    W_V(attr_value);
+    W_L("\"");
+  }
+  if(attr_valuetype){
+    W_L(" valuetype=\"");
+    W_V(attr_valuetype);
+    W_L("\"");
+  }
+  W_L(" />");
+  return jxhtml->out;
+}
 /*
  * vim:ts=2 et
  */