473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Weather board, how to get html data.

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.
Apr 18 '06 #1
9 3870
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
"Boki" <bo******@ms21.hinet.net> wrote in message
news:OL*************@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.

Apr 18 '06 #2
On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bo******@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
Apr 18 '06 #3

gene kelley 寫道:
On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bo******@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.

Apr 18 '06 #4
Boki,

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

http://www.vb-tips.com/default.aspx?...a-22589f018cd4

I hope this helps,

Cor

"Boki" <bo******@ms21.hinet.net> schreef in bericht
news:11**********************@v46g2000cwv.googlegr oups.com...

gene kelley ??:
On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bo******@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.
Apr 18 '06 #5
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
-----------------
"Boki" <bo******@ms21.hinet.net> wrote in message
news:OL*************@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.

Apr 18 '06 #6
"Boki" <bo******@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/>

Apr 18 '06 #7

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eL**************@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!)
Apr 18 '06 #8
You can try SWExplorerAutomation (http:\\webunittesting.com).

Apr 18 '06 #9
On 18 Apr 2006 01:03:50 -0700, "Boki" <bo******@ms21.hinet.net> wrote:

gene kelley ???
On Tue, 18 Apr 2006 13:46:29 +0800, Boki <bo******@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
Apr 19 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: futureofphp | last post by:
Hi I am having a PHP based intranet home page. How can I add local weather forecast for the day to it? Is there any free weather forevast providers? I am interested in the local weather of Europe....
0
by: Jeremy Jones | last post by:
is looking for two software developers to develop tests (written in Python) to test our internally developed applications for the cable tier. There is a reference to the job on the Python Job...
1
by: pmclinn | last post by:
I have the xml feed belowfrom this link: http://www.weather.gov/alerts/ct.rss I for the life of me can not get this data to format in a html table using client side scripting. Any help would be...
0
by: jimb | last post by:
Looking for a simple view on the weather. Just learning the xml stuff. I would like to add to the the weather.com icon. Any help is appreciated. <html> <head> <body bgcolor="#000000"...
3
by: dawnrager | last post by:
Hi, everyone. I'm having a really difficult time pasting in generated code from the Weather Channel for a weather sticker for my webpage. This was the code sent to me via email: <!-- cut and...
2
by: sandeep patil | last post by:
how to diplay the weather condiction on my webpage suppose i want to read weather from www.bbc.co.uk/weather.html how i can read it usin program
2
by: seancron | last post by:
Does anybody have any suggestions for getting started on desigining a desktop weather application in Python? I've been looking for access to weather data and while I have found several including...
4
by: shaynenash | last post by:
I wrote this script to calculate if water restrictions were in place if it was hotter than 25deg C. It has turned out to be a pretty good weather widget that can be used elsewhere. This was initially...
2
by: Craig M | last post by:
Our current intranet site displays the weather with a 7 day forecast. We have to manually enter all the weather info into a SQL DB using a web front end, but would like to use an RSS feed. All...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.