Consume namespace values in google.feeds.Feed(feedUrl)

43 views
Skip to first unread message

uninvitedinquirer

unread,
Oct 16, 2013, 7:13:37 PM10/16/13
to google-ajax...@googlegroups.com
Hello Google API developers,

I have imported the namespace xmlns:ev="http://purl.org/rss/1.0/modules/event/" into my RSS feed, adding <ev:startdate>2011-10-19</ev:startdate>, for example,  to my RSS feed. I can consume the  'standard' RSS items...  title, link, descripton, throught the Google Feed API using var entry = result.feed.entries[0]; and say newsBlockTitleWrapper.innerHTML = "<a href='"+entry.link+"'>"+entry.title+"</a>";.

However I was questioning how I do I consume the namespace ev items, a guess would be var eventdate = document.createElement("p");eventdate.appendChild(document.createTextNode(new Date(entry.ev:startdate))); but to no avail... ns defines it as a date.
 
Can I drop the ev namespace in the RSS feed?, or can I have to search and replace of var entry = result.feed.entries[0]; replacing <ev:startdate> with <startdate>, so I can then consume it via var eventdate = document.createElement("p");eventdate.appendChild(document.createTextNode(new Date(entry.startdate)));
 
Any help much appreciated.
 
Thanks,
 
UninvitedInquirer.

Jeremy Geerdes

unread,
Oct 16, 2013, 10:40:05 PM10/16/13
to google-ajax...@googlegroups.com
The API doesn't just automatically make custom namespace elements available in the JS. You will need to get the feed in MIXED format and then use DOM methods to navigate the entry.xmlNode node to find what you're looking for.

jg


--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-searc...@googlegroups.com
To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/d70e1688-4db7-42f4-9f40-9c5ba16bbe69%40googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

uninvitedinquirer

unread,
Oct 17, 2013, 7:12:08 AM10/17/13
to google-ajax...@googlegroups.com
Brilliant, sorted, thanks for the pointer.
Reply all
Reply to author
Forward
0 new messages