Keltoi
02-07-2009, 05:07 PM
I'm going to post this here as I'm programming in ASP, though the error would seem to with parsing the XML data.
The error message I'm getting is: The system cannot find the path specified.
Here's the code:<%
Response.Buffer = True
Dim xml, results
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://search.twitter.com/search.atom?q=hello&rpp=1", False
xml.setRequestHeader "Content-Type", "content=text/html; charset=iso-8859-1"
xml.setRequestHeader "User-Agent", "MySearch"
xml.Send
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load xml.responseText
If objXMLDoc.parseError.errorCode <> 0 then
Response.Write "there was an error: " & objXMLDoc.parseError.reason
Response.End()
End If
Set results = objXMLDoc.documentElement
Set NodeList = results.getElementsByTagName("entry")
For Each Elem In NodeList
Response.Write Elem.selectSingleNode("id").text & "<br />"
Next
Set objXMLDoc=Nothing
Set xml = Nothing
%>
and here's an example of the XML:<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
<id>tag:search.twitter.com,2005:search/hello</id>
<link type="text/html" rel="alternate" href="http://search.twitter.com/search?q=hello"/>
<link type="application/atom+xml" rel="self" href="http://search.twitter.com/search.atom?q=hello&rpp=1"/>
<title>hello - Twitter Search</title>
<link type="application/opensearchdescription+xml" rel="search" href="http://search.twitter.com/opensearch.xml"/>
<link type="application/atom+xml" rel="refresh" href="http://search.twitter.com/search.atom?q=hello&rpp=1&since_id=1186618046"/>
<warning>adjusted since_id, it was older than allowed</warning>
<updated>2009-02-07T16:40:12Z</updated>
<openSearch:itemsPerPage>1</openSearch:itemsPerPage>
<openSearch:language>en</openSearch:language>
<link type="application/atom+xml" rel="next" href="http://search.twitter.com/search.atom?max_id=1186618046&page=2&q=hello&rpp=1"/>
<entry>
<id>tag:search.twitter.com,2005:1186618046</id>
<published>2009-02-07T16:40:12Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/lauzrox/statuses/1186618046"/>
<title>@zane_lowe hello:)</title>
<content type="html"><a href="http://twitter.com/zane_lowe">@zane_lowe</a> <b>hello</b>:)</content>
<updated>2009-02-07T16:40:12Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/76229215/mee_in_the_snow_normal.jpg"/>
<author>
<name>lauzrox (lauren Edwards)</name>
<uri>http://twitter.com/lauzrox</uri>
</author>
</entry>
</feed>
The XML looks fine to me, has anyone any ideas on what is going on (and hopefully a fix)
Many thanks
Justin
The error message I'm getting is: The system cannot find the path specified.
Here's the code:<%
Response.Buffer = True
Dim xml, results
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://search.twitter.com/search.atom?q=hello&rpp=1", False
xml.setRequestHeader "Content-Type", "content=text/html; charset=iso-8859-1"
xml.setRequestHeader "User-Agent", "MySearch"
xml.Send
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load xml.responseText
If objXMLDoc.parseError.errorCode <> 0 then
Response.Write "there was an error: " & objXMLDoc.parseError.reason
Response.End()
End If
Set results = objXMLDoc.documentElement
Set NodeList = results.getElementsByTagName("entry")
For Each Elem In NodeList
Response.Write Elem.selectSingleNode("id").text & "<br />"
Next
Set objXMLDoc=Nothing
Set xml = Nothing
%>
and here's an example of the XML:<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
<id>tag:search.twitter.com,2005:search/hello</id>
<link type="text/html" rel="alternate" href="http://search.twitter.com/search?q=hello"/>
<link type="application/atom+xml" rel="self" href="http://search.twitter.com/search.atom?q=hello&rpp=1"/>
<title>hello - Twitter Search</title>
<link type="application/opensearchdescription+xml" rel="search" href="http://search.twitter.com/opensearch.xml"/>
<link type="application/atom+xml" rel="refresh" href="http://search.twitter.com/search.atom?q=hello&rpp=1&since_id=1186618046"/>
<warning>adjusted since_id, it was older than allowed</warning>
<updated>2009-02-07T16:40:12Z</updated>
<openSearch:itemsPerPage>1</openSearch:itemsPerPage>
<openSearch:language>en</openSearch:language>
<link type="application/atom+xml" rel="next" href="http://search.twitter.com/search.atom?max_id=1186618046&page=2&q=hello&rpp=1"/>
<entry>
<id>tag:search.twitter.com,2005:1186618046</id>
<published>2009-02-07T16:40:12Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/lauzrox/statuses/1186618046"/>
<title>@zane_lowe hello:)</title>
<content type="html"><a href="http://twitter.com/zane_lowe">@zane_lowe</a> <b>hello</b>:)</content>
<updated>2009-02-07T16:40:12Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/76229215/mee_in_the_snow_normal.jpg"/>
<author>
<name>lauzrox (lauren Edwards)</name>
<uri>http://twitter.com/lauzrox</uri>
</author>
</entry>
</feed>
The XML looks fine to me, has anyone any ideas on what is going on (and hopefully a fix)
Many thanks
Justin