6. How to obtain XML formatted search results

On occassion you may require XML formatted search results when you do searches. You may also obtain the Document Type Definition (DTD) if you set the output parameter xml instead of xml_no_dtd. In order to do this type of search you should set up your web form in the following manner:

 <div class="searchbox"> <form id="searchform" method="put"
               action="http://googlesearch.oucs.ox.ac.uk/search"> <fieldset>
               <legend>Your text or image here</legend> <input
               name="site" value="oucs" type="hidden"/> <input name="client"
               value="oxford" type="hidden"/> <input name="output" value="xml"
               type="hidden"/> <input name="q" id="input-search" size="25"
               onfocus="clearsearch();" maxlength="2048" value="" class="vam" type="text"/>
               <input name="Go" value="Go!" type="submit"/> </fieldset>
               </form> </div> 

Here the Unit, UnitPicture and proxystylesheet inputs have been removed, and outputnow has a value of XML.

Performing a search with the above form will present the search results in XML format:

XML search output

The returned search data can now be formatted using your own customised XSL stylesheet and finally presented to the end user.

Up: Contents Previous: 5. Google Customised Search Collections Next: 7. Synonyms