File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Easy way to parse HTTP response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Easy way to parse HTTP response" Watch "Easy way to parse HTTP response" New topic
Author

Easy way to parse HTTP response

Matthew Busse
Ranch Hand

Joined: Sep 29, 2010
Posts: 52
Hello Java Geniuses,

I'm using HTTPClient to access a website using a POST request. Does HTTPClient provide any tools for easily parsing the response? The "tutorials" on the Apache website were not much help, I had to search several other sites just the get the POST request working.

For example, I'm getting back a table like this:


Is there an easy way to convert that into an excel file or XML document or something?

Thanks!



Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I like the HtmlUnit (or jWebUnit) library for interacting programmatically with a web site. It has various methods for accessing and extracting specific bits of an HTML page's content.
Matthew Busse
Ranch Hand

Joined: Sep 29, 2010
Posts: 52
Tim Moores wrote:I like the HtmlUnit (or jWebUnit) library for interacting programmatically with a web site. It has various methods for accessing and extracting specific bits of an HTML page's content.


Great, HtmlUnit looks like it has a lot of potential.

My only hesitation is that the form request methods in HtmlUnit seem rather clunky, you have to look at the source page to get the form name and the name of the submit button, etc.

Am I correct in thinking HtmlUnit is built on HttpClient? Is it possible to use the post request methods from HttpClient and feed that response into HtmlUnit?

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Easy way to parse HTTP response