PDA

View Full Version : Parsing a web page


suu
01-16-2004, 03:23 AM
Hello!

i've got a page that contains text, images and grids and a glossary DB.

i need to parse my page and if there are any words in common with a field on my DB i will highlight those words.

now, i've managed to do this but only using a string.
does anyone know how i can parse the page instaed of using a string?

here's my code:

<%
Dim strFinal, teste_highlight, aux,rs, Conn, SQLStmt
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DSN=AmbienteDSN;"
Set rs = Server.CreateObject("ADODB.Recordset")
SQLStmt = "SELECT * FROM TBL_Glossario"
rs.Open SQLstmt,Conn,1,2
strMudar=" 1///////////// Ambiente dskfjb Smog djfgdff Acidente Transformador de potência Acção correctiva sdfh Resíduo Achiever sdfsdf Ambientais /////////////1 "
If Not rs.EOF Then
While Not rs.EOF
aux = rs("Termos")
'response.write aux
teste_highlight = "<B><FONT color=#800000><span style=""background-color: #FFFF00"">" & aux & "</span></FONT></B>"
strFinal= replace(strMudar,aux,teste_highlight)
strMudar=strFinal
rs.MoveNext
Wend
End If
rs.close
response.write strMudar
%>

--> strMudar is my output text. i need the search the entire page instead of a string.

BaldEagle
01-27-2005, 03:06 PM
Try assembling the whole page into a string then do the replace outside the loop as well as the final assignment.

BaldEagle