2010-11-27 47 views

回答

0

下面是一個例子

// Query the API for content 
     String content = getUrlContent(String.format(WIKTIONARY_PAGE, 
       encodedTitle, expandClause)); 
     try { 
      // Drill into the JSON response to find the content body 
      JSONObject response = new JSONObject(content); 
      JSONObject query = response.getJSONObject("query"); 
      JSONObject pages = query.getJSONObject("pages"); 
      JSONObject page = pages.getJSONObject((String) pages.keys().next()); 
      JSONArray revisions = page.getJSONArray("revisions"); 
      JSONObject revision = revisions.getJSONObject(0); 
      return revision.getString("*"); 
     } catch (JSONException e) { 
      throw new ParseException("Problem parsing API response", e); 
     } 
+0

欣賞的迅速反應。我會試試這個,分享我的經驗。再次感謝 ...!!! – bp581 2010-11-28 01:40:43