Forum Moderators: open
Left
temp = left(strHtml, 10) Right
temp = right(strHtml, 10) Instr
temp = instr(strHtml, "c") strHtml = "abcdefghijk"
temp = instr(strHtml, "c") Len
temp = len(strHtml) There are a couple more, but this is all you need to start. I don't really know what info you want, but say you wanted to grab just the table (and there was only one table on the page):
temp = instr(strHtml, "</table>") 'Check where the table ends strHtml = left(strHtml, temp - 1) temp = instr(strHtml, "<table ") 'Check where the table starts strHtml = right(strHtml, (len(strHtml) - temp) + 1) Hope this helped you
//ZS
You need to delete all content up to a known point in the page (e.g. the marker), either using regular expressions or a function to do this.
You then step through the table, again using regular expressions or a specific function you create, to extract the relevant info from the table and insert it into a database.
If you want the individual data elements in the table inserting into individual columns of your database, then one way of doing it would be to break the table in an array of <tr></tr> tags, then step through this, breaking the content into an array of <td>Content</td>s. From there it should be simple to extract the content and do the database insert.
HTH,
JP
temp = instr(strHtml, "</table>") 'Check where the table ends
strHtml = left(strHtml, temp - 1)
temp = instr(strHtml, "<table ") 'Check where the table starts
strHtml = right(strHtml, (len(strHtml) - temp) + 1)
Now, assuming strHtml is = "<TABLE><TR><TD>1.1</TD><TD>1.2</TD></TR><TR><TD>2.1</TD><TD>2.2</TD></TR>"
arRows = Split(strHtml,"<TR>") 'Array of Rows
For x = 0 to Ubound(arRows) 'Start Looping through Rows
arColumns = Split(arRows(x),"<TD>") 'Array of Columns for current row
For y = 1 to Ubound(arColumns) 'Start Looping through Cols
If len(trim(arColumns(y))) > 0 Then 'Make sure you have data
iTDPos = instr(1,arColumns(y),"</TD>")
strTDRemoved = left(arColumns(y), iTDPos-1) ' Removes everything right of the </TD> including </TABLE>
response.Write "Row: " & x & " Col: " & y & " = " & strTDRemoved & "<BR>"
End If
next
next