Home All Groups Group Topic Archive Search About

Weather board, how to get html data.

Author
18 Apr 2006 5:46 AM
Boki
Hi All,

I am going to create a personal weather board.

It is easy to show the picutre on website ( just link the picture to
picturesbox's properties )

but I dont' know how to add some other text near by..

for example:

I can get the weather icon, but I don't know how to get the description
text...

What should I do?

Best regards,
Boki.

Author
18 Apr 2006 6:05 AM
OHM ( One Handed Man )
Depends if you are talking about text adjacent to the picture or Alernate
text, iether way you will need to scrape the site and parse the text. Seach
for web scraping on google.

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
Show quoteHide quote
"Boki" <bokit***@ms21.hinet.net> wrote in message
news:OLbEztqYGHA.428@TK2MSFTNGP02.phx.gbl...
> Hi All,
>
> I am going to create a personal weather board.
>
> It is easy to show the picutre on website ( just link the picture to
> picturesbox's properties )
>
> but I dont' know how to add some other text near by..
>
> for example:
>
> I can get the weather icon, but I don't know how to get the description
> text...
>
> What should I do?
>
> Best regards,
> Boki.
Author
18 Apr 2006 7:15 AM
gene kelley
On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bokit***@ms21.hinet.net>
wrote:

Show quoteHide quote
>Hi All,
>
>I am going to create a personal weather board.
>
>It is easy to show the picutre on website ( just link the picture to
>picturesbox's properties )
>
>but I dont' know how to add some other text near by..
>
>for example:
>
>I can get the weather icon, but I don't know how to get the description
>text...
>
>What should I do?
>
>Best regards,
>Boki.

Don't know where you are, but if in the U.S. the NWS has several XML
feeds which make it very easy to use directly in a app.  Here is a
current observation example:
http://www.weather.gov/data/current_obs/KSFO.xml

Gene
Author
18 Apr 2006 8:03 AM
Boki
gene kelley 寫道:

Show quoteHide quote
> On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bokit***@ms21.hinet.net>
> wrote:
>
> >Hi All,
> >
> >I am going to create a personal weather board.
> >
> >It is easy to show the picutre on website ( just link the picture to
> >picturesbox's properties )
> >
> >but I dont' know how to add some other text near by..
> >
> >for example:
> >
> >I can get the weather icon, but I don't know how to get the description
> >text...
> >
> >What should I do?
> >
> >Best regards,
> >Boki.
>
> Don't know where you are, but if in the U.S. the NWS has several XML
> feeds which make it very easy to use directly in a app.  Here is a
> current observation example:
> http://www.weather.gov/data/current_obs/KSFO.xml
>
> Gene

I use InStr() to search WebBrowser1.DocumentText, could you please
advice how to search the XML data tag? ( a better way than InStr() )..

Best regards,
Boki.
Author
18 Apr 2006 8:26 AM
Cor Ligthert [MVP]
Boki,

To read an unknown xml document is this probably the easiest method

http://www.vb-tips.com/default.aspx?ID=e788c048-e547-4de3-9c6a-22589f018cd4

I hope this helps,

Cor

"Boki" <bokit***@ms21.hinet.net> schreef in bericht
news:1145347430.260286.251230@v46g2000cwv.googlegroups.com...

gene kelley ??:

Show quoteHide quote
> On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bokit***@ms21.hinet.net>
> wrote:
>
> >Hi All,
> >
> >I am going to create a personal weather board.
> >
> >It is easy to show the picutre on website ( just link the picture to
> >picturesbox's properties )
> >
> >but I dont' know how to add some other text near by..
> >
> >for example:
> >
> >I can get the weather icon, but I don't know how to get the description
> >text...
> >
> >What should I do?
> >
> >Best regards,
> >Boki.
>
> Don't know where you are, but if in the U.S. the NWS has several XML
> feeds which make it very easy to use directly in a app.  Here is a
> current observation example:
> http://www.weather.gov/data/current_obs/KSFO.xml
>
> Gene

I use InStr() to search WebBrowser1.DocumentText, could you please
advice how to search the XML data tag? ( a better way than InStr() )..

Best regards,
Boki.
Author
19 Apr 2006 6:19 AM
gene kelley
Show quote Hide quote
On 18 Apr 2006 01:03:50 -0700, "Boki" <bokit***@ms21.hinet.net> wrote:

>
>gene kelley ???
>
>> On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bokit***@ms21.hinet.net>
>> wrote:
>>
>> >Hi All,
>> >
>> >I am going to create a personal weather board.
>> >
>> >It is easy to show the picutre on website ( just link the picture to
>> >picturesbox's properties )
>> >
>> >but I dont' know how to add some other text near by..
>> >
>> >for example:
>> >
>> >I can get the weather icon, but I don't know how to get the description
>> >text...
>> >
>> >What should I do?
>> >
>> >Best regards,
>> >Boki.
>>
>> Don't know where you are, but if in the U.S. the NWS has several XML
>> feeds which make it very easy to use directly in a app.  Here is a
>> current observation example:
>> http://www.weather.gov/data/current_obs/KSFO.xml
>>
>> Gene
>
>I use InStr() to search WebBrowser1.DocumentText, could you please
>advice how to search the XML data tag? ( a better way than InStr() )..
>
>Best regards,
>Boki.

As noted in other responses, you would want to read the XML elements
directly (XML Reader Class).  Has nothing to do with a WebBrowser.

Gene
Author
18 Apr 2006 10:29 AM
Ken Tucker [MVP]
Hi,

            I have used the yahoo weather rss for this.   They have a
weather sticker embedded in it.  The address for the rss feed has a
querystring for getting the weather.  In the us use your zipcode for getting
the weather. This example requires a textbox (txtZip) for entering in a
zipcode to get the weather for, webbrowser control to display the weather
sticker, and a button (btnGetWeather).

    Private Sub btnGetWeather_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnGetWeather.Click
        Dim sr As IO.StreamReader
        Dim wc As New System.Net.WebClient
        Dim strUrl As String
        Dim strOut As String = ""
        strUrl =
String.Format("http://xml.weather.yahoo.com/forecastrss?p={0}", txtZip.Text)

        Try
            sr = New IO.StreamReader(wc.OpenRead(strUrl))
            Dim strHtml As String = sr.ReadToEnd
            Dim x As Integer = strHtml.IndexOf("<img src")
            Dim y As Integer = strHtml.IndexOf(")<br/>")
            strOut = strHtml.Substring(x, y - x + 6)
            sr.Close()
        Catch
            strOut = "<h1>Error getting weather</h1>"
        Finally
            WebBrowser1.DocumentText = strOut
        End Try
    End Sub

Ken
-----------------
Show quoteHide quote
"Boki" <bokit***@ms21.hinet.net> wrote in message
news:OLbEztqYGHA.428@TK2MSFTNGP02.phx.gbl...
> Hi All,
>
> I am going to create a personal weather board.
>
> It is easy to show the picutre on website ( just link the picture to
> picturesbox's properties )
>
> but I dont' know how to add some other text near by..
>
> for example:
>
> I can get the weather icon, but I don't know how to get the description
> text...
>
> What should I do?
>
> Best regards,
> Boki.
Author
18 Apr 2006 4:37 PM
james
Show quote Hide quote
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eL4I1LtYGHA.4752@TK2MSFTNGP02.phx.gbl...
> Hi,
>
>            I have used the yahoo weather rss for this.   They have a
> weather sticker embedded in it.  The address for the rss feed has a
> querystring for getting the weather.  In the us use your zipcode for
> getting the weather. This example requires a textbox (txtZip) for entering
> in a zipcode to get the weather for, webbrowser control to display the
> weather sticker, and a button (btnGetWeather).
>
>    Private Sub btnGetWeather_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles btnGetWeather.Click
>        Dim sr As IO.StreamReader
>        Dim wc As New System.Net.WebClient
>        Dim strUrl As String
>        Dim strOut As String = ""
>        strUrl =
> String.Format("http://xml.weather.yahoo.com/forecastrss?p={0}",
> txtZip.Text)
>
>        Try
>            sr = New IO.StreamReader(wc.OpenRead(strUrl))
>            Dim strHtml As String = sr.ReadToEnd
>            Dim x As Integer = strHtml.IndexOf("<img src")
>            Dim y As Integer = strHtml.IndexOf(")<br/>")
>            strOut = strHtml.Substring(x, y - x + 6)
>            sr.Close()
>        Catch
>            strOut = "<h1>Error getting weather</h1>"
>        Finally
>            WebBrowser1.DocumentText = strOut
>        End Try
>    End Sub
>
> Ken


Neat Ken!!! And works well.
james

(not the original poster, but, someone who appreciates interesting code!)
Author
18 Apr 2006 12:10 PM
Herfried K. Wagner [MVP]
"Boki" <bokit***@ms21.hinet.net> schrieb:
> I am going to create a personal weather board.
>
> It is easy to show the picutre on website ( just link the picture to
> picturesbox's properties )
>
> but I dont' know how to add some other text near by..
>
> for example:
>
> I can get the weather icon, but I don't know how to get the description
> text...

Parsing an HTML file:

MSHTML Reference
<URL:http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/reference.asp>

- or -

..NET Html Agility Pack: How to use malformed HTML just like it was
well-formed XML...
<URL:http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx>

Download:

<URL:http://www.codefluent.com/smourier/download/htmlagilitypack.zip>

- or -

SgmlReader 1.4
<URL:http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC>

If the file read is in XHTML format, you can use the classes contained in
the 'System.Xml' namespace for reading information from the file.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
18 Apr 2006 7:16 PM
alex_f_il
You can try SWExplorerAutomation (http:\\webunittesting.com).