Pages: [1]   Go Down
Author Topic: XML Feeds  (Read 1826 times)
0 Members and 1 Guest are viewing this topic.
Los Angeles, CA, United States
Offline Offline
Full Member
***
Karma: 2
Posts: 212
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231812230.
I need to create two feeds. One will display the current date and time and the other will display how many new emails I have in Gmail (my email provider). I will then combine the two feeds to create one feed that I will retrieve using the code provided earlier. Does anybody know any services that will allow me to do this?

Thanks, Carnyworld...

PS: Sorry if this is the wrong section, its the best section that I could find.
Logged

C program run. C program crash. C programmer quit.

Los Angeles, CA, United States
Offline Offline
Full Member
***
Karma: 2
Posts: 212
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What I am asking is how I can see how I can see how many emails I have, the current time, and what the current temperature is... All via rss feed.
« Last Edit: December 29, 2010, 12:59:46 pm by Carnyworld » Logged

C program run. C program crash. C programmer quit.

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 222
Posts: 13856
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you crossposted (?) and I answered in the other thread - http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293601117

If you search the forum with weather and web you should ffind relevant links for temp.
« Last Edit: December 29, 2010, 01:13:32 pm by robtillaart » Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Los Angeles, CA, United States
Offline Offline
Full Member
***
Karma: 2
Posts: 212
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, ignore the other post. How would I display the Current Time though?
Logged

C program run. C program crash. C programmer quit.

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 222
Posts: 13856
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Connect a DS1307 RTC (RealTime Clock) to your Arduino. Lady ada sells a nice shield with RTC and has a tutorial on their site how to use the RTC library. See - http://www.ladyada.net/make/logshield/

Once you set the time of the DS1307 it will be quite accurate for years. You can set the RTC by means of the NTP protocol, see - http://www.arduino.cc/playground/Main/DS1307OfTheLogshieldByMeansOfNTP

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Los Angeles, CA, United States
Offline Offline
Full Member
***
Karma: 2
Posts: 212
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I now have a feed at http://www.google.com/reader/atom/user%2F15916171905404598697%2Flabel%2FArduino

I need help with this part of code:
Code:
  // Find specific tags and print data
      if (matchTag("<temp_f>")) {
            Serial.print("Temp: ");
         Serial.print(dataStr);
      }
      if (matchTag("<relative_humidity>")) {
            Serial.print(", Humidity: ");
         Serial.print(dataStr);
      }
      if (matchTag("<pressure_in>")) {
            Serial.print(", Pressure: ");
         Serial.print(dataStr);
         Serial.println("");
      }
How can I extract the text of each emails subject line as they all have the same tags which in this case is <title type="html"></title>.

Currently also I have the feed displaying more than just temperature. How can I extract only the temperature and nothing else?
Logged

C program run. C program crash. C programmer quit.

Los Angeles, CA, United States
Offline Offline
Full Member
***
Karma: 2
Posts: 212
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the Feed:

Code:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
      
[ch8722]
<feed idx:index="no" gr:dir="ltr">
<!--
Content-type: Preventing XSRF in IE.

-->
<generator uri="http://www.google.com/reader">Google Reader</generator>
[ch8722]
<id>
tag:google.com,2005:reader/user/15916171905404598697/label/Arduino
</id>
<title>"Arduino" via Christopher in Google Reader</title>
<link rel="self" href="http://www.google.com/reader/atom/user%2F15916171905404598697%2Flabel%2FArduino"/>
[ch8722]
<author>
<name>Christopher</name>
</author>
<updated>2010-12-29T23:02:09Z</updated>
[ch8722]
<entry gr:crawl-timestamp-msec="1293663729775">
<id gr:original-id="tag:gmail.google.com,2004:1356504650833327926">tag:google.com,2005:reader/item/ec593d1f5b807205</id>
<category term="user/15916171905404598697/label/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle" scheme="http://www.google.com/reader/"/>
<category term="user/15916171905404598697/state/com.google/reading-list" scheme="http://www.google.com/reader/" label="reading-list"/>
<category term="user/15916171905404598697/state/com.google/fresh" scheme="http://www.google.com/reader/" label="fresh"/>
<title type="html">shadow</title>
<published>2010-12-29T23:00:45Z</published>
<updated>2010-12-29T23:00:45Z</updated>
<link rel="alternate" href="http://mail.google.com/mail?account_id=christopherjelledge@gmail.com&message_id=12d345caf915f736&view=conv&extsrc=atom" type="text/html"/>
[ch8722]
<summary xml:base="http://mail.google.com/mail" type="html">
This email was sent via Anonymous email service for free. YOU CAN REMOVE THIS TEXT MESSAGE BY ...
</summary>
[ch8722]
<author>
<name>Chkhdkj</name>
</author>
[ch8722]
<source gr:stream-id="feed/http://freemyfeed.com/feed/aHR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vbWFpbC9mZWVkL2F0b206OkNocmlzdG9waGVyamVsbGVkZ2U6OkY0VVIrWGI1TzdCemU4bmpNNEpjT3pvNk1RPT0=">
[ch8722]
<id>
tag:google.com,2005:reader/feed/http://freemyfeed.com/feed/aHR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vbWFpbC9mZWVkL2F0b206OkNocmlzdG9waGVyamVsbGVkZ2U6OkY0VVIrWGI1TzdCemU4bmpNNEpjT3pvNk1RPT0=
</id>
<title type="html">Gmail - Inbox for christopherjelledge@gmail.com</title>
<link rel="alternate" href="http://mail.google.com/mail" type="text/html"/>
</source>
</entry>
[ch8722]
<entry gr:crawl-timestamp-msec="1293663729775">
<id gr:original-id="tag:gmail.google.com,2004:1356502460486981398">tag:google.com,2005:reader/item/2a2148e7bd9ba34d</id>
<category term="user/15916171905404598697/label/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle" scheme="http://www.google.com/reader/"/>
<category term="user/15916171905404598697/state/com.google/reading-list" scheme="http://www.google.com/reader/" label="reading-list"/>
<category term="user/15916171905404598697/state/com.google/fresh" scheme="http://www.google.com/reader/" label="fresh"/>
<title type="html">Test</title>
<published>2010-12-29T22:25:56Z</published>
<updated>2010-12-29T22:25:56Z</updated>
<link rel="alternate" href="http://mail.google.com/mail?account_id=christopherjelledge@gmail.com&message_id=12d343ccfe451716&view=conv&extsrc=atom" type="text/html"/>
<summary xml:base="http://mail.google.com/mail" type="html">Test</summary>
[ch8722]
<author>
<name>me</name>
</author>
[ch8722]
<source gr:stream-id="feed/http://freemyfeed.com/feed/aHR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vbWFpbC9mZWVkL2F0b206OkNocmlzdG9waGVyamVsbGVkZ2U6OkY0VVIrWGI1TzdCemU4bmpNNEpjT3pvNk1RPT0=">
[ch8722]
<id>
tag:google.com,2005:reader/feed/http://freemyfeed.com/feed/aHR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vbWFpbC9mZWVkL2F0b206OkNocmlzdG9waGVyamVsbGVkZ2U6OkY0VVIrWGI1TzdCemU4bmpNNEpjT3pvNk1RPT0=
</id>
<title type="html">Gmail - Inbox for christopherjelledge@gmail.com</title>
<link rel="alternate" href="http://mail.google.com/mail" type="text/html"/>
</source>
</entry>
[ch8722]
<entry gr:is-read-state-locked="true" gr:crawl-timestamp-msec="1293658655144">
<id gr:original-id="CurrentTxt-Wed, 29 Dec 2010 21:00:00 GMT">tag:google.com,2005:reader/item/c8a200bc564d48a3</id>
<category term="user/15916171905404598697/state/com.google/read" scheme="http://www.google.com/reader/" label="read"/>
<category term="user/15916171905404598697/label/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle" scheme="http://www.google.com/reader/"/>
<category term="user/15916171905404598697/state/com.google/reading-list" scheme="http://www.google.com/reader/" label="reading-list"/>
[ch8722]
<title type="html">
Current Conditions from Notre Dame HS, Sherman Oaks, CA
</title>
<published>2010-12-29T21:00:00Z</published>
<updated>2010-12-29T21:00:00Z</updated>
<link rel="alternate" href="http://web.live.weatherbug.com/Common/home.aspx?zcode=z4641&zip=91423&units=0&rnd=Obs122920101600" type="text/html"/>
[ch8722]
<summary xml:base="http://web.live.weatherbug.com/Common/Home.aspx?zcode=z4641&zip=91423" type="html">
<b>Temperature:</b> 52.9 °F          
                        <br>
                        <br>
                              <b>Humidity:</b> 99 %    
                              <b>Wind Speed:</b> 4 mph ESE    
                              <b>Pressure:</b> 29.63 &quot;    
                        <br>
                        <br>      
                              <b>Dew Point:</b> 53 °F    
                              <b>Gusts:</b> 15 mph E    
                              <b>Rain Today:</b> 0.42 &quot;    
                        <br>
</summary>
[ch8722]
<author gr:unknown-author="true">
<name>(author unknown)</name>
</author>
[ch8722]
<source gr:stream-id="feed/http://feeds.weatherbug.com/rss.aspx?zipcode=91423&feed=currtxt&zcode=z4641">
[ch8722]
<id>
tag:google.com,2005:reader/feed/http://feeds.weatherbug.com/rss.aspx?zipcode=91423&feed=currtxt&zcode=z4641
</id>
<title type="html">WeatherBug Current Conditions for 91423</title>
<link rel="alternate" href="http://web.live.weatherbug.com/Common/Home.aspx?zcode=z4641&zip=91423" type="text/html"/>
</source>
</entry>
[ch8722]
<entry gr:is-read-state-locked="true" gr:crawl-timestamp-msec="1293649440301">
<id gr:original-id="CurrentTxt-Wed, 29 Dec 2010 19:00:00 GMT">tag:google.com,2005:reader/item/595e0762c068ce17</id>
<category term="user/15916171905404598697/state/com.google/read" scheme="http://www.google.com/reader/" label="read"/>
<category term="user/15916171905404598697/label/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle/Arduino" scheme="http://www.google.com/reader/" label="Arduino"/>
<category term="user/15916171905404598697/bundle" scheme="http://www.google.com/reader/"/>
<category term="user/15916171905404598697/state/com.google/reading-list" scheme="http://www.google.com/reader/" label="reading-list"/>
[ch8722]
<title type="html">
Current Conditions from Notre Dame HS, Sherman Oaks, CA
</title>
<published>2010-12-29T19:00:00Z</published>
<updated>2010-12-29T19:00:00Z</updated>
<link rel="alternate" href="http://web.live.weatherbug.com/Common/home.aspx?zcode=z4641&zip=91423&units=0&rnd=Obs122920101400" type="text/html"/>
[ch8722]
<summary xml:base="http://web.live.weatherbug.com/Common/Home.aspx?zcode=z4641&zip=91423" type="html">
<b>Temperature:</b> 51.6 °F          
                        <br>
                        <br>
                              <b>Humidity:</b> 99 %    
                              <b>Wind Speed:</b> 4 mph ESE    
                              <b>Pressure:</b> 29.7 &quot;    
                        <br>
                        <br>      
                              <b>Dew Point:</b> 51 °F    
                              <b>Gusts:</b> 15 mph E    
                              <b>Rain Today:</b> 0.42 &quot;    
                        <br>
</summary>
[ch8722]
<author gr:unknown-author="true">
<name>(author unknown)</name>
</author>
[ch8722]
<source gr:stream-id="feed/http://feeds.weatherbug.com/rss.aspx?zipcode=91423&feed=currtxt&zcode=z4641">
[ch8722]
<id>
tag:google.com,2005:reader/feed/http://feeds.weatherbug.com/rss.aspx?zipcode=91423&feed=currtxt&zcode=z4641
</id>
<title type="html">WeatherBug Current Conditions for 91423</title>
<link rel="alternate" href="http://web.live.weatherbug.com/Common/Home.aspx?zcode=z4641&zip=91423" type="text/html"/>
</source>
</entry>
</feed>
Logged

C program run. C program crash. C programmer quit.

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 222
Posts: 13856
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How can I extract the text of each emails subject line as they all have the same tags which in this case is <title type="html"></title>.

Think you just need to add the following code for your email-titles and as the code parses all XML passing by they will all be detected.. give it a try.

Code:
     
if (matchTag("<title type=\"html\">"))    // NOTE the \ 's
{
  Serial.print(", Mail:  ");
  Serial.print(dataStr);
  Serial.println();                  // omit ""
 }

so add all the 'stuff found' in the tag or do a half Tag test

Code:
     
if (matchTag("<title "))    // simpler match not as robust but will prob work.
{
  Serial.print(", Mail:  ");
  Serial.print(dataStr);
  Serial.println();                  // omit ""
 }

As matchTag() is just a wrapper around stringcmp(),  you can speed up things a tiny bit by using strcmp directly.
« Last Edit: December 30, 2010, 03:24:56 am by robtillaart » Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 222
Posts: 13856
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Currently also I have the feed displaying more than just temperature. How can I extract only the temperature and nothing else?

What does it show - note that the forummembers cannot see your display smiley

Please share your whole code as that makes it much easier to help.
« Last Edit: December 30, 2010, 03:31:00 am by robtillaart » Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: