List Info

Thread: RE: ASP.NET and Upcoming API




RE: ASP.NET and Upcoming API
country flaguser name
United States
2007-10-10 11:38:07

I'm not familiar with the .Net API, coming from the Java world that is, and having implemented a SAX parser for the Upcoming output.
It is possible that your query returns > 1 event element and your code has a problem picking that up.

> -------- Original Message --------
> Subject: [yws-events] ASP.NET and Upcoming API
> From: "stewsterl" < stewsterl%40comcast.net">stewsterlcomcast.net>
&gt; Date: Wed, October 10, 2007 9:35 am
> To: yws-events%40yahoogroups.com">yws-eventsyahoogroups.com
&gt;
> I'm currently working on an ASP.NET site that needs to use the
> Upcoming API.
>
> I have the following code to get the returned XML:
>;
> Dim url As String = "http://upcoming.yahooapis.com/services/rest/?
&gt; method=venue.search&amp;location=Troy,3;MI&api_key=<Your Key>&quot;
>
> Dim RequestXMLstring As String = "<?xml version='1.0'?
>; ><element1>Some Value</element1>;"
> Dim XmlResult As New System.Xml.XmlDocument
> Dim anXMLhttpObject As Object
&gt; anXMLhttpObject = Server.CreateObject("MSXML2.ServerXMLHTTP")
>
> Try
> anXMLhttpObject.open("POST", url, False)
&gt; Catch
&gt; Response.Write(";Connection cannot be established. Please
> try again later.&quot;)
> End Try
>
> anXMLhttpObject.setRequestHeader("Content-
&gt; Type", "application/x-www-form-urlencoded&quot;)
&gt;
> anXMLhttpObject.setRequestHeader("Content-Length", Len
> (RequestXMLstring))
>
> anXMLhttpObject.send(RequestXMLstring)
>
> Dim strResult As String = anXMLhttpObject.responseText
>
> XmlResult.LoadXml(strResult)
>
> '***************************************
>
> Dim bodyAttrib As System.Xml.XmlNodeList =
> XmlResult.SelectNodes("rsp/")
>
> For Each attr As XmlNode In bodyAttrib
> Dim name As XmlAttribute = DirectCast
> (attr.Attributes.GetNamedItem("name&quot;), XmlAttribute)
> Dim val As XmlAttribute = DirectCast
> (attr.Attributes.GetNamedItem("description";), XmlAttribute)
> If name IsNot Nothing AndAlso val IsNot Nothing Then
>; TextBox1.Text = name.Value & val.Value
> End If
> Next
>;
> I get the results just fine. I'm having a little trouble parsing the
> xml here -->XmlResult.SelectNodes(&quot;rsp/&quot;)
> I've tried: XmlResult.SelectNodes("rsp/event";)
> No luck.. Anyone have any ideas?
&gt;
> Thank you in advance..

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )