using xml for live search

For the XML interface, there is an interface specific parameter XmlType, which can control the flavor of XML interface. If ElementBased enumeration is specified, each field will be rendered as a separated tag. If AttributeBased enumeration is specified, all simple type fields will be rendered as attributes instead of elements. The default value is ElementBased.

The following sections give an example request and response for each of these options.

ElementBased Enumeration Example

Request





http://api.search.live.net/xml.aspx?AppId = [YOUR_APPID] &market=en-US&Query=testign&Sources=web+spell&web.count=1&xmltype=elementbased

Note: For information about obtaining an AppId, see Live Search Developer Center.





Response

<?xml version="1.0" encoding="utf-8" ?>

<?pageview_candidate?>

<SearchResponse xmlns="http://schemas.microsoft.com/LiveSearch/2008/04/XML/element" Version="2.0">

  <Query>

    <SearchTerms>testign</SearchTerms>

  </Query>

  <spl:Spell xmlns:spl="http://schemas.microsoft.com/LiveSearch/2008/04/XML/spell">

    <spl:Total>1</spl:Total>

    <spl:Results>

      <spl:SpellResult>

        <spl:Value>testing </spl:Value>

      </spl:SpellResult>

    </spl:Results>

  </spl:Spell>

  <web:Web xmlns:web="http://schemas.microsoft.com/LiveSearch/2008/04/XML/web">

    <web:Total>5680</web:Total>

    <web:Offset>0</web:Offset>

    <web:Results>

      <web:WebResult>

        <web:Title>Hacker News | PHP Unit testign</web:Title>

        <web:Description>PHP Unit testign: 1 point by amrithk 134 days ago | 1 comment: Interested to know what tools people use/recommend for unit testing for PHP? What do people think about PHPUnit?</web:Description>

        <web:Url>http://news.ycombinator.com/item?id=196435</web:Url>

        <web:DisplayUrl>http://news.ycombinator.com/item?id=196435</web:DisplayUrl>

        <web:DateTime>2008-10-03T15:09:15Z</web:DateTime>

      </web:WebResult>

    </web:Results>

  </web:Web>

</SearchResponse>
source: http://msdn.microsoft.com/en-us/library/dd250893.aspx
This entry was posted in xml and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>