0

I am using HTTP client 4.1.2.I want to access outlook web and get mails data.Here is the code which I have done.

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);
}

The output is HTML page in the from of String.How can I convert this into XML?

1 Answer 1

1

Technically speaking, well formed HTML is a form of XML, or at least that's the goal any way.

But we're talking Microsoft here...

I use Cobra to interact with HTML as if it was XML, allowing me to use things like xPath to search the document or just access the plain old DOM.

Sign up to request clarification or add additional context in comments.

3 Comments

if i can convert the HTML into Plain DOM can i get the data
If you use Cobra (and the HTML is well formed) you already do (have the DOM) ... and yes ...
Thank you.I will try with Cobra

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.