Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6010129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:04:20+00:00 2026-05-23T02:04:20+00:00

I am trying to retrieve data from a RSS feed (succeeding with this part)

  • 0

I am trying to retrieve data from a RSS feed (succeeding with this part) and then using the description, title and caption to be used to get Geo information (latitude, longitude, woeId) using YQL Placemaker open datatable.

This is all then needed to be output as JSON.

The permalink to test it in the YQL console is here.

Any ideas whats wrong with my xml code or what should I try instead?

   <meta>
    <author>Yahoo! Inc.</author>
    <documentationURL>http://i-magine.mobi/</documentationURL>
    <sampleQuery>select * from {table} where section="topstories" and description matches ".*jpg.*"</sampleQuery>
    <description>Searches Yahoo.news RSS</description>
  </meta>


 <bindings>
    <select itemPath="" produces="XML">
      <urls>
        <url>http://rss.news.yahoo.com/rss/topstories/{section}
        </url>
      </urls>
      <inputs>
        <key id='section' type="xs:string" paramType="path" required="true" />
      </inputs>


      <execute><![CDATA[
        default xml namespace = "http://where.yahooapis.com/v1/schema.rng";

        // http://www.json.org/json2.js
                y.include('http://www.i-magine.mobi/json2.js');

        rssStorySection = [];

         rssStoryNumber = [];
         rssStoryTitle = [];
         rssStorySummary = [];
         rssImageCaption = [];
         rssStoryUrl = [];
         rssImageUrl = [];

         rssGeoText = []; 

//  var content = 'They followed him to deepest Africa after Brussels and Tokyo and found him there in Timbuktu';       

        var rssQuery = 'select * from rss where url = ' + "'" + 'http://rss.news.yahoo.com/rss/' + section + "'" + ' and description matches ".*jpg.*" limit 30';


      res1 = y.query(rssQuery);
      data1 = res1.results;


//    var geoQuery = 'SELECT * FROM geo.placemaker WHERE documentContent =' + '"' + content + '"' + 'AND documentType=' + '"' +  'text/plain' + '"';


//    res2 = y.query(geoQuery);
//    data2 =  res2.results;



      for (var c=0;c<data1.item.length;c++)
    {
        var story = data1.item[c];

            var storyTitleText0 = story.title + ""; 

        var storyUrl = story.link + "";

        var description = story.description;

        var storyTitleText = storyTitleText0.replace(/\n/ig, "") + "";  

        var imageUrl = description.match(/http:\/\/d.*?jpg/i) + "";

            var imageCaptionText0 = description.match(/alt="([^ ]).*border/) + "";
            var imageCaptionText1 = imageCaptionText0.replace(/alt="/ig, "") + "";
        var imageCaptionText = imageCaptionText1.replace(/" border.*/ig, "") + "";

        var storySummaryText = description.replace(/<[^>]*>([\s]?)*<[^>]*>/g, "") + ""; 

            var storySection0 = description.match(/http[^ ].*\*/i) + "";        
            var storySection1 = storySection0.replace(/\/\*/ig, "") + "";       
        var storySection = storySection1.replace(/http:\/\/us.rd.yahoo.com\/dailynews\/rss\//ig, "") + "";  

        var geoString = (imageCaptionText + " " + storyTitleText + " " + storySummaryText);

        rssStorySection.push(storySection);
        rssStoryTitle.push(storyTitleText);
        rssStorySummary.push(storySummaryText);
        rssImageCaption.push(imageCaptionText);     
        rssStoryUrl.push(storyUrl);
        rssImageUrl.push(imageUrl);
        rssGeoText.push(geoString);
        rssStoryNumber.push(c);

    var content = geoString;

    var geoQuery = 'SELECT * FROM geo.placemaker WHERE documentContent =' + '"' + content + '"' + 'AND documentType=' + '"' +  'text/plain' + '"';


     var res2 = y.query(geoQuery);
     var data2 =  res2.results;     

              }


        var d = data1;
        var e = data2;

                    response.object = <stories>
                                <c>{section}</c>
                                <d>{d}</d>
                                <e>{e}</e>          
                      </stories>;



           ]]></execute>



    </select>
  </bindings>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:04:21+00:00Added an answer on May 23, 2026 at 2:04 am

    A tidied up (and “working” in the sense that it brings back RSS+Placemaker results) version of your table looks like:

    <?xml version="1.0" encoding="UTF-8" ?>
    <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
       <meta>
        <author>Peter Cowburn</author>
        <documentationURL>http://stackoverflow.com/questions/6168564/creating-a-yql-opentable-to-combine-rss-data-with-placemaker-map-info</documentationURL>
        <sampleQuery>select * from {table} where section='topstories'</sampleQuery>
        <description>Searches Yahoo! News RSS and injects Placemaker Places</description>
      </meta>
      <bindings>
        <select itemPath="stories.story" produces="XML">
          <urls>
            <url>
                http://rss.news.yahoo.com/rss/{section}
            </url>
          </urls>
          <inputs>
            <key id="section" type="xs:string" paramType="path" required="true" />
          </inputs>
          <execute><![CDATA[
    
    // Fetch top 30 feed items with jpg images
    var feed = y.query(
      'select * from rss where url=@url and description matches ".*jpg.*" limit 30',
      {url: request.url}
    ).results;
    
    // Build geo queries
    var placeQuery = 'select * from geo.placemaker where documentContent=@text and documentType="text/plain"';
    var placeQueries = [];
    var title, description, caption, summary, content;
    for each (result in feed.item) {
      title       = result.title.text().toString();
      description = y.tidy(result.description.toString()).body.p;
      caption     = description.a.img.@alt.toString();
      summary     = description..*.text().toString();
      content     = caption + " " + title + " " + summary;
      placeQueries.push({
        query:   y.query(placeQuery, {text: content}),
        item:    result,
        results: null
      });
    }
    
    // Execute all queries
    var where = new Namespace('http://wherein.yahooapis.com/v1/schema');
    var matches, match, places = [];
    for (var q in placeQueries) {
      matches = placeQueries[q].query.results.matches.match;
      placeQueries[q].results = matches..where::place;
    }
    
    // Build response object
    var stories = <stories/>;
    for each (q in placeQueries) {
      stories.node += <story>
        {q.item}
        {q.results}
      </story>;
    }
    
    response.object = stories;
    
          ]]></execute>
        </select>
      </bindings>
    </table>
    

    You can use it by pointing to the table online (it may not be around forever!) in a query like:

    use 'https://raw.github.com/salathe/yql-tables/so-6168564/yahoo/newswithplaces.xml'
    as rssplaces;
    select * from rssplaces where section='topstories';
    

    (Try this in the YQL console)

    The table uses some of the features available in <execute> blocks like E4X, query parameters and parallel queries which all make life easier but may be slightly foreign at first glance.

    P.S. The above is offered as-is, I’m not going to be bending over backwards to field “support” questions on this. It is primarily intended as something to get you moving, an introduction to an approach which might work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using XmlReader.Create to retrieve data from an RSS xml file. Then I
I'm trying to retrieve data from an api using curl with this code: $xml_data
I 'm trying to retrieve data from a datastore by using this (in example)
I am trying to retrieve and use the raw data from RSS feeds. For
Using PyClips, I'm trying to build rules in Clips that dynamically retrieve data from
I am using liferay technology and trying to retrieve data from xml file in
I'm trying to retrieve some data from a JSON response, but this doesn't seem
I am trying to retrieve JSON data from an external text file using a
I am trying to retrieve the text data from an ePub file using Java.
I am using the dojox.charting.widget.Chart2D and I am trying to retrieve the data from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.