Parsing GeoRSS Feed with jQuery

Posted by senfo on Stack Overflow See other posts from Stack Overflow or by senfo
Published on 2010-04-06T00:01:41Z Indexed on 2010/04/06 0:13 UTC
Read the original article Hit count: 785

Filed under:
|
|
|
|

I'm attempting to use the jQuery jFeed plugin for parsing an Atom, GeoRSS feed and I'm running into issues extracting the information I need. For example, I need to extract the summary element and I would like to render the contents in a div on my HTML page. Additionally, I'd like to extract the contents from the georss:point elements and pass them into Google Maps to render them as points on a map. The problem is that it seems jFeed is stripping out the GeoRSS-related information. For example, I can extract the title element without issues, but it seems it doesn't extract the summary or georss:point elements, at all.

Following is a snippet of the XML I'm working with:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">
  <title>Search Results from DataWarehouse.HRSA.gov</title>
  <link rel="self" href="http://datawarehouse.hrsa.gov/HGDWDataWebService/HGDWDataService.aspx?service=HC&zip=20002&radius=10"/>
  <link rel="alternate" href="http://datawarehouse.hrsa.gov/"/>
  <author>
    <name>HRSA Geospatial Data Warehouse</name>
  </author>
  <id>tag:datawarehouse.hrsa.gov,2010-04-05:/</id>
  <updated>2010-04-05T19:25:28-05:00</updated>
  <entry>
    <title>Christ House</title>
    <link href="http://www.christhouse.org" />
    <id>tag:datawarehouse.hrsa.gov,2010-04-05:/D388C4C6-FFA4-4091-819B-64D67DC64931</id>
    <summary type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div class="vcard">
          <div class="fn org">Christ House</div>
          <div class="adr">
            <div class="street-address">1717 Columbia Rd. N.W.</div>            <span class="locality">Washington</span>,            <span class="region">District of Columbia</span>,            <span class="postal-code">20009-2803</span>
          </div>
          <div class="tel">202-328-1100</div>
        </div>
        <div>
          Categories:          <span class="category">Service Delivery Site</span>
        </div>
      </div>
    </summary>
    <georss:point>38.9243636363636 -77.0395636363637</georss:point>
    <updated>2010-04-04T00:00:00-05:00</updated>
  </entry>
</feed>

Following is the jQuery code that I'm using:

$(document).ready(function() {
  $.getFeed({
    //url: 'http://datawarehouse.hrsa.gov/HGDWDataWebService/HGDWDataService.aspx?service=HC&zip=20002&radius=10',
    url: 'test.xml',
    success: function(feed) {
        $.each(feed.items, function(index, value) {
            $('#rssContent').append(value.title); // Set breakpoint here
        });
    }
  });
});

I set a breakpoint on the line that appends to the rssContent div and noticed the objects in feed.items don't have the properties I'm after. Am I doing something wrong or was jFeed simply not designed to work the way I want it to?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jfeed