tengo un archivo ke deseo leer como texto..
tiene el formato de un html con unas tablas..
dichas tablas las kiero importar a mi base de datos. pero no se como leer linnea por linea celda por celda de la tabla html para ir metiendo esa info en el campo ke le corresponde..
el formato de mi html seria este.
Código HTML:
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=us-ascii"> <meta name=ProgId content=Excel.Sheet> <meta name=Generator content="Microsoft Excel 11"> <link rel=File-List href="excel_productos_archivos/filelist.xml"> <link rel=Edit-Time-Data href="excel_productos_archivos/editdata.mso"> <link rel=OLE-Object-Data href="excel_productos_archivos/oledata.mso"> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:LastAuthor>oktopus</o:LastAuthor> <o:LastSaved>2009-07-07T14:27:58Z</o:LastSaved> <o:Version>11.9999</o:Version> </o:DocumentProperties> </xml><![endif]--> <style> <!--table {mso-displayed-decimal-separator:"\,"; mso-displayed-thousand-separator:"\.";} @page {margin:.98in .79in .98in .79in; mso-header-margin:0in; mso-footer-margin:0in;} tr {mso-height-source:auto;} col {mso-width-source:auto;} br {mso-data-placement:same-cell;} .style0 {mso-number-format:General; text-align:general; vertical-align:bottom; white-space:nowrap; mso-rotate:0; mso-background-source:auto; mso-pattern:auto; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0; border:none; mso-protection:locked visible; mso-style-name:Normal; mso-style-id:0;} td {mso-style-parent:style0; padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;} .xl24 {mso-style-parent:style0; font-weight:700; vertical-align:top; border:.5pt solid black; white-space:normal;} .xl25 {mso-style-parent:style0; font-weight:700; vertical-align:top; border-top:.5pt solid black; border-right:.5pt solid black; border-bottom:.5pt solid black; border-left:none; white-space:normal;} .xl26 {mso-style-parent:style0; font-weight:700; text-align:center; vertical-align:top; border-top:.5pt solid black; border-right:.5pt solid black; border-bottom:.5pt solid black; border-left:none; white-space:normal;} .xl27 {mso-style-parent:style0; vertical-align:top; border-top:none; border-right:.5pt solid black; border-bottom:.5pt solid black; border-left:.5pt solid black; white-space:normal;} .xl28 {mso-style-parent:style0; text-align:center; vertical-align:top; border-top:none; border-right:.5pt solid black; border-bottom:.5pt solid black; border-left:none; white-space:normal;} .xl29 {mso-style-parent:style0; vertical-align:top; border-top:none; border-right:.5pt solid black; border-bottom:.5pt solid black; border-left:none; white-space:normal;} .xl30 {mso-style-parent:style0; text-align:right; vertical-align:top; border-top:none; border-right:.5pt solid black; border-bottom:.5pt solid black; border-left:none; white-space:normal;} --> </style> <!--[if gte mso 9]><xml> <x:ExcelWorkbook> <x:ExcelWorksheets> <x:ExcelWorksheet> <x:Name>excel_productos</x:Name> <x:WorksheetOptions> <x:DefaultColWidth>10</x:DefaultColWidth> <x:Selected/> <x:DoNotDisplayGridlines/> <x:Panes> <x:Pane> <x:Number>3</x:Number> <x:ActiveRow>11</x:ActiveRow> <x:ActiveCol>5</x:ActiveCol> </x:Pane> </x:Panes> <x:ProtectContents>False</x:ProtectContents> <x:ProtectObjects>False</x:ProtectObjects> <x:ProtectScenarios>False</x:ProtectScenarios> </x:WorksheetOptions> </x:ExcelWorksheet> </x:ExcelWorksheets> <x:WindowHeight>8835</x:WindowHeight> <x:WindowWidth>18780</x:WindowWidth> <x:WindowTopX>240</x:WindowTopX> <x:WindowTopY>120</x:WindowTopY> <x:ProtectStructure>False</x:ProtectStructure> <x:ProtectWindows>False</x:ProtectWindows> </x:ExcelWorkbook> </xml><![endif]--> </head> <body link=blue vlink=purple> <table x:str border=0 cellpadding=0 cellspacing=0 width=1642 style='border-collapse: collapse;table-layout:fixed;width:1232pt' name=inicio> <col width=159 style='mso-width-source:userset;mso-width-alt:5814;width:119pt'> <col width=183 style='mso-width-source:userset;mso-width-alt:6692;width:137pt'> <col width=108 style='mso-width-source:userset;mso-width-alt:3949;width:81pt'> <col width=152 style='mso-width-source:userset;mso-width-alt:5558;width:114pt'> <col width=126 style='mso-width-source:userset;mso-width-alt:4608;width:95pt'> <col width=594 style='mso-width-source:userset;mso-width-alt:21723;width:446pt'> <col width=152 style='mso-width-source:userset;mso-width-alt:5558;width:114pt'> <col width=168 style='mso-width-source:userset;mso-width-alt:6144;width:126pt'> <tr height=20 style='mso-height-source:userset;height:15.0pt' name=encabezado> <td height=20 class=xl24 width=159 style='height:15.0pt;width:119pt' name="codigo_empresa">CODIGO_SAR</td> <td class=xl25 width=183 style='width:137pt' name="codigo_proveedor">CODIGO_PROVEEDOR</td> <td class=xl26 width=108 style='width:81pt' name="id_unidad">ID_UNIDAD</td> <td class=xl26 width=152 style='width:114pt' name=unidad>UNIDAD</td> <td class=xl26 width=126 style='width:95pt' name="id_producto">ID_PRODUCTO</td> <td class=xl25 width=594 style='width:446pt' name="nombre_producto">NOMBRE_PRODUCTO</td> <td class=xl25 width=152 style='width:114pt' name="precio_pesos">PRECIO_PESOS</td> <td class=xl25 width=168 style='width:126pt' name="precio_dolares">PRECIO_DOLARES</td> </tr> <tr height=20 style='mso-height-source:userset;height:15.0pt' name=1> <td height=20 class=xl27 align=right width=159 style='height:15.0pt; width:119pt' x:num name="codigo_empresa">1010001</td> <td class=xl28 width=183 style='width:137pt' name="codigo_proveedor">-</td> <td class=xl28 width=108 style='width:81pt' x:num name="id_unidad">2</td> <td class=xl28 width=152 style='width:114pt' name=unidad>UNIDAD</td> <td class=xl28 width=126 style='width:95pt' x:num name="id_producto">1</td> <td class=xl29 width=594 style='width:446pt' name="nombre_producto">WT 1 73PULG X 15 M ANSI 150</td> <td class=xl30 width=152 style='width:114pt' x:num name="precio_pesos">5000</td> <td class=xl30 width=168 style='width:126pt' x:num name="precio_dolares">0</td> </tr> <tr height=20 style='mso-height-source:userset;height:15.0pt' name=2> <td height=20 class=xl27 align=right width=159 style='height:15.0pt; width:119pt' x:num name="codigo_empresa">1010002</td> <td class=xl28 width=183 style='width:137pt' name="codigo_proveedor">-</td> <td class=xl28 width=108 style='width:81pt' x:num name="id_unidad">2</td> <td class=xl28 width=152 style='width:114pt' name=unidad>UNIDAD</td> <td class=xl28 width=126 style='width:95pt' x:num name="id_producto">2</td> <td class=xl29 width=594 style='width:446pt' name="nombre_producto">WT 2 ANSI 150 48PULG X 15'</td> <td class=xl30 width=152 style='width:114pt' x:num name="precio_pesos">0</td> <td class=xl30 width=168 style='width:126pt' x:num name="precio_dolares">3000</td> </tr> <tr height=20 style='mso-height-source:userset;height:15.0pt' name=3> <td height=20 class=xl27 align=right width=159 style='height:15.0pt; width:119pt' x:num name="codigo_empresa">1010003</td> <td class=xl28 width=183 style='width:137pt' name="codigo_proveedor">-</td> <td class=xl28 width=108 style='width:81pt' x:num name="id_unidad">2</td> <td class=xl28 width=152 style='width:114pt' name=unidad>UNIDAD</td> <td class=xl28 width=126 style='width:95pt' x:num name="id_producto">3</td> <td class=xl29 width=594 style='width:446pt' name="nombre_producto">WT 3 ANSI 600 42PULG X 10'</td> <td class=xl30 width=152 style='width:114pt' x:num name="precio_pesos">0</td> <td class=xl30 width=168 style='width:126pt' x:num name="precio_dolares">500</td> </tr> <![if supportMisalignedColumns]> <tr height=0 style='display:none'> <td width=159 style='width:119pt'></td> <td width=183 style='width:137pt'></td> <td width=108 style='width:81pt'></td> <td width=152 style='width:114pt'></td> <td width=126 style='width:95pt'></td> <td width=594 style='width:446pt'></td> <td width=152 style='width:114pt'></td> <td width=168 style='width:126pt'></td> </tr> <![endif]> </table> </body> </html>