Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml feed and characters

Status
Not open for further replies.

amiw

Programmer
Apr 1, 2003
113
GB
have a look at this page,
the page is using an xml feed to grab content of the dmoz directory... though as you'll see there are a few problems with the Spanish words and ? comes up a few times.

'heres the code
'=======================================
<%
If Request(&quot;ID&quot;) = &quot;&quot; Then
Response.Redirect &quot;index.asp&quot;
End If
Function getit(strAdd,strFrom,strTo)
Dim objXMLHTTP, strGot, strSource
Set objXMLHTTP = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
objXMLHTTP.Open &quot;GET&quot;, strAdd, False
objXMLHTTP.Send
strSource = objXMLHTTP.responseText
Set objXMLHTTP = Nothing

Dim b,e
b=Instr(strSource,strFrom)
If b<>0 Then
b=b+Len(strFrom)
e=Instr(b,strSource,strTo)
strGot=Mid(strSource, b, e-b)
Else
Response.Write &quot; &quot;
End If

getit = strGot
End Function

dim Grabbed, CopyFrom, CopyTo

Grabbed = &quot; & request.querystring(&quot;ID&quot;)
CopyFrom = &quot;</form>&quot;
CopyTo = &quot;<table width=&quot;&quot;95%&quot;&quot; cellpadding=0 cellspacing=0>&quot;

Dim strSource
strSource = getit(Grabbed,CopyFrom,CopyTo)
strSource=Replace(strSource,&quot;<b>&quot;,&quot; &quot;)
strSource=Replace(strSource,&quot;</b>&quot;,&quot; &quot;)
strSource=Replace(strSource,&quot;<hr>&quot;,&quot; &quot;)
strSource=Replace(strSource,&quot;+1&quot;,&quot;2&quot;)

Dim once, twice
once = Replace(strSource,&quot;<a href=&quot;&quot;desc.html&quot;,&quot;<a href=&quot;&quot; & Request(&quot;ID&quot;) & &quot;desc.html&quot; & &quot;&quot;&quot;&quot; & &quot; target=&quot;&quot;_new&quot;)
twice = Replace(once,&quot;href=&quot;&quot;/&quot;,&quot;href=&quot;&quot;directory.asp?ID=&quot;)
If twice = &quot;&quot; Then
%>
</p>
<table border=&quot;1&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;100%&quot; align=&quot;center&quot;><font face=&quot;Arial&quot;>Sorry This
Page Is Currently Un-Available<BR>
<A HREF=&quot;javascript:history.back();&quot;><<< BACK</A></font></td>
</tr>
</table>
<%
Else
response.write twice
End If
%>

hope u can help, much appreciated.

Thanks
Michael.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top