String Apikey = "111111111111111111111111111111"; String Isbnurl = "http://api.douban.com/book/subject/isbn/"; public static void Main (string[] args) throws Exception {//requesturl = Isbnurl + Isbnno + "? apikey=" + Apikey;//eg:http ://api.douban.com/book/subject/isbn/9787111298854?apikey=111111111111111111114 ISBN isbnTest = new ISBN (); String Isbnno = "9787111298854"; String XML = Isbntest.fetchbookinfobyxml (Isbnno); SYSTEM.OUT.PRINTLN (XML); /** * Obtains data from the watercress according to the ISBN number. has applied for Apikey, up to 40 requests per minute, sufficient. * @param isbnno * @return * @throws ioexception * * Public String Fetchbookinfobyxml (string isbnno) throws IOException {St Ring Requesturl = Isbnurl + Isbnno + "? apikey=" + Apikey; URL url = new URL (requesturl); URLConnection conn = Url.openconnection (); InputStream is = Conn.getinputstream (); InputStreamReader ISR = new InputStreamReader (IS, "utf-8"); BufferedReader br = new BufferedReader (ISR); StringBuilder sb = new StringBuilder (); String line = null; while (line = Br.readline ()) = null) {sB.append (line); } br.close (); return sb.tostring (); }