http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=srikanthpragada
http://api.search.yahoo.com/WebSearchService/V1/WebSearchResponse.xsd
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*,java.net.*,javax.xml.*,javax.xml.bind.*,yahoo.srch.*,java.util.List" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Yahoo Search Client</title> </head> <body> <h2>Yahoo Search Client</h2> <form action="index.jsp"> Enter your search string : <input type=text name="word" size=20 value="${param.word}"> <input type=submit value="Search" /> </form> <p/> <% String word = request.getParameter("word"); if ( word == null) return; // create JAXB unmarshaller with no schema validation. JAXBContext context = JAXBContext.newInstance(ResultSet.class); Unmarshaller unmarshaller = context.createUnmarshaller(); unmarshaller.setSchema(null); //No Schema // search for the given string String yahoourl = "http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=" + word; URL url = new URL(yahoourl); // unmarshall XML document provided by service. ResultSet allresults = ResultSet.class.cast(unmarshaller.unmarshal(url.openStream())); List<ResultType> results = allresults.getResult(); // display results as hyperlinks for(ResultType res : results) { out.println("<a href=" + res.getUrl() + ">" + res.getTitle() + "</a><p/>"); } %> </body> </html>