你现在的流程是:
上传html——解析html——插入Excel——解析Excel——插入数据库你解析的Excel数据如果跟解析的html数据没啥子区别,我认为还是变一变
上传html——解析html——插入Excel——插入数据库内容已经解析过了,就不要在解析一次了吧!

解决方案 »

  1.   

    我的想法是直接解析htm,但是这样处理合并单元太麻烦了。
      

  2.   

    直接解析html插入数据库不就完了
      

  3.   

    上传html???哪如果要修改数据的话,是去修改html代码???如果你只是要入库的话那就直接解析html中的xml,为什么还要经过excel呢....
      

  4.   

    我现在想做一个上传excel,解析excel,导入数据库,求帮助,谢谢!
      

  5.   

    回复于: 2014-01-16 18:03:38
    直接解析html插入数据库不就完了
      

  6.   


    我的想法是,上传后转换为Excel文件,然后用poi操作。这个思路不错  楼主可以试试
      

  7.   

    主要是htm中好多合并的单元格,处理起来比较麻烦。
    不知道有没有好的方法,把htm转换为excel,处理excel就方便多了。
      

  8.   


    我的想法是,上传后转换为Excel文件,然后用poi操作。这个思路不错  楼主可以试试
    思路是这个思路,但是没有好的解决方法。求助
      

  9.   

    你的需求跟我差不多,如果是excel,那就容易多了,可以试下poi解析excel,然后拼接sql批量插入数据库。
      

  10.   

    既然是XML,为什么要弄成excel呢,解析XML→封装信息成对象→插入数据库
      

  11.   

    并不是严格意义上的XML,文本打开部分内容如下:
    <tr height=20 style='mso-height-source:userset;height:15.0pt'>
      <td height=20 class=xl96 style='height:15.0pt'>21200632801</td>
      <td class=xl94> </td>
      <td class=xl94>G109</td>
      <td class=xl94>青藏线</td>
      <td class=xl153 x:num>3671</td>
      <td class=xl152 x:num>3672</td>
      <td class=xl141 x:num>1000</td>
      <td class=xl94>上行</td>
      <td class=xl95>沥青</td>
      <td class=xl99 width=42 style='width:32pt' x:num>82.5</td>
      <td class=xl100 width=42 style='width:32pt' x:num>82.8</td>
      <td class=xl100 width=42 style='width:32pt' x:num>95</td>
      <td class=xl100 width=42 style='width:32pt' x:num>60</td>
      <td class=xl100 width=42 style='width:32pt'> </td>
      <td class=xl92></td>
     </tr>
     <tr height=20 style='mso-height-source:userset;height:15.0pt'>
      <td height=20 class=xl96 style='height:15.0pt'>21200632801</td>
      <td class=xl94> </td>
      <td class=xl94>G109</td>
      <td class=xl94>青藏线</td>
      <td class=xl153 x:num>3672</td>
      <td class=xl152 x:num>3673</td>
      <td class=xl141 x:num>1000</td>
      <td class=xl94>上行</td>
      <td class=xl95>沥青</td>
      <td class=xl99 width=42 style='width:32pt' x:num>85.9</td>
      <td class=xl100 width=42 style='width:32pt' x:num>83.7</td>
      <td class=xl100 width=42 style='width:32pt' x:num>70</td>
      <td class=xl100 width=42 style='width:32pt' x:num>100</td>
      <td class=xl100 width=42 style='width:32pt'> </td>
      <td class=xl92></td>
     </tr>
      

  12.   

    并不是严格意义上的XML,文本打开部分内容如下:
    <tr height=20 style='mso-height-source:userset;height:15.0pt'>
      <td height=20 class=xl96 style='height:15.0pt'>21200632801</td>
      <td class=xl94> </td>
      <td class=xl94>G109</td>
      <td class=xl94>青藏线</td>
      <td class=xl153 x:num>3671</td>
      <td class=xl152 x:num>3672</td>
      <td class=xl141 x:num>1000</td>
      <td class=xl94>上行</td>
      <td class=xl95>沥青</td>
      <td class=xl99 width=42 style='width:32pt' x:num>82.5</td>
      <td class=xl100 width=42 style='width:32pt' x:num>82.8</td>
      <td class=xl100 width=42 style='width:32pt' x:num>95</td>
      <td class=xl100 width=42 style='width:32pt' x:num>60</td>
      <td class=xl100 width=42 style='width:32pt'> </td>
      <td class=xl92></td>
     </tr>
     <tr height=20 style='mso-height-source:userset;height:15.0pt'>
      <td height=20 class=xl96 style='height:15.0pt'>21200632801</td>
      <td class=xl94> </td>
      <td class=xl94>G109</td>
      <td class=xl94>青藏线</td>
      <td class=xl153 x:num>3672</td>
      <td class=xl152 x:num>3673</td>
      <td class=xl141 x:num>1000</td>
      <td class=xl94>上行</td>
      <td class=xl95>沥青</td>
      <td class=xl99 width=42 style='width:32pt' x:num>85.9</td>
      <td class=xl100 width=42 style='width:32pt' x:num>83.7</td>
      <td class=xl100 width=42 style='width:32pt' x:num>70</td>
      <td class=xl100 width=42 style='width:32pt' x:num>100</td>
      <td class=xl100 width=42 style='width:32pt'> </td>
      <td class=xl92></td>
     </tr>
    你试试用htmlparser看行不,这个专门解析Html的
      

  13.   

    你的需求跟我差不多,如果是excel,那就容易多了,可以试下poi解析excel,然后拼接sql批量插入数据库。
    碰到同样的问题,已经写好了Excel的解析,包括对其中数据的验证.
    可后来发现用户可能上传Html格式的Excel,于是也在找转换工具,不是XML真是悲剧啊