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

  • Home
  • SEARCH
  • 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 6139399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:59:06+00:00 2026-05-23T17:59:06+00:00

I am trying to parse the XML returned by search engine APIs (Bing, Yahoo

  • 0

I am trying to parse the XML returned by search engine APIs (Bing, Yahoo & Blekko). The returned XML (for sample search query ‘sushi’) from Blekko takes the form:

<rss version="2.0">
<channel>
    <title>blekko | rss for &quot;sushi/rss /ps=100&quot;</title>
    <link>http://blekko.com/?q=sushi%2Frss+%2Fps%3D100</link>
    <description>Blekko search for &quot;sushi/rss /ps=100&quot;</description>
    <language>en-us</language>
    <copyright>Copyright 2011 Blekko, Inc.</copyright>
    <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
    <webMaster>webmaster@blekko.com</webMaster>
    <rescount>3M</rescount>
    <item>
        <title>Sushi - Wikipedia</title>
        <link>http://en.wikipedia.org/wiki/Sushi</link>
        <guid>http://en.wikipedia.org/wiki/Sushi</guid>
        <description>Article about sushi, a food made of vinegared rice combined with various toppings or fillings.  Sushi ( &#x3059;&#x3057;&#x3001;&#x5bff;&#x53f8;, &#x9ba8;, &#x9b93;, &#x5bff;&#x6597;, &#x5bff;&#x3057;, &#x58fd;&#x53f8;.</description>
        </item>
</channel>
</rss>

The section of python code to extract the required search result data is:

for counter in range(100):
    try:
        for item in BlekkoSearchResultsXML.getElementsByTagName('item'):
            Blekko_PageTitle = item.getElementsByTagName('title')[counter].toxml(encoding="utf-8")
            Blekko_PageDesc = item.getElementsByTagName('description')[counter].toxml(encoding="utf-8")
            Blekko_DisplayURL = item.getElementsByTagName('guid')[counter].toxml(encoding="utf-8")
            Blekko_URL = item.getElementsByTagName('link')[counter].toxml(encoding="utf-8")
            print "<h2>" + Blekko_PageTitle + "</h2><br />"
            print Blekko_PageDesc + "<br />"
            print Blekko_DisplayURL + "<br />"
            print Blekko_URL + "<br />"
    except IndexError:
        break

The code will not extract the Page Title of each search result returned, but does extract the rest of the info.

Furthermore, if I do not have the code:

print "<title>Page title to appear on browser tab</title>"

somewhere in the script, the title from the first search result is taken as the page title (i.e. the page appears with the title ‘Sushi – Wikipedia’ in the browser). If I do have a page title, the code still does not extract the page title from the search result.

The same code (with different tag names etc.) has the same problem with the Yahoo search API, but works fine with the Bing search API.

  • 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-23T17:59:07+00:00Added an answer on May 23, 2026 at 5:59 pm

    I guess that the .toxml() method returns the XML for the element, including its delimiting tags, and then you’re getting something like this:

    <h2><title>...</title></h2><br />
    <description>...</description><br />
    <guid>...</guid><br />
    

    The title element is therefore interpreted as the page’s title, unless you specify your own in advance. Other elements are unknown to the browser, and it just displays their content as is.

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

Sidebar

Related Questions

I ran into a problem while trying to parse an XML string returned from
I'm trying to parse XML returned from the Youtue API. The APIcalls work correctly
I'm trying to parse the xml document returned from this link but I get
I am trying to parse XML in Perl using XML::SAX parser . My query
I'm trying to use the Macromedia XSLTransform class to convert XML returned from Amazon
Im trying to parse the XML returned by the Google Geo code API ,but
I'm trying to parse some xml using simplexml and php...it's being returned to me
I trying to parse xml from an inputstream using the sax parser. The inputstream
I am trying to parse XML feeds from YouTube using jQuery (by doing $(xml).find(...)
I'm trying to parse xml from SharePoint service (lists) using jquery. I have XMLHttpRequest

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.