我正在使用 HTTP 客户端 4.1.2。我想访问 Outlook Web 并获取邮件数据。这是我完成的代码。
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope(AuthScope.ANY_HOST,
AuthScope.ANY_PORT,AuthScope.ANY_REALM, AuthPolicy.BASIC),
new UsernamePasswordCredentials(Username, password));
DefaultHttpClient Client= new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet get= new HttpGet(uri);
HttpEntity entity = response.getEntity();
String html=null;
if(!entity.equals(null)){
html=EntityUtils.toString(entity,HTTP.UTF_8);
}
输出是来自 String 的 HTML 页面。如何将其转换为 XML?