Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Parsing a web page

Thread view: 
HMS Surprise - 08 May 2007 19:40 GMT
Greetings,

I am using a tool called maxq (maxq.tigris.org) that acts a proxy and
is used for web page testing. It generates jython scripts for playback
of web sessions and testing. It lacks a tool for parsing a web page,
it only provides the return code. I need to parse the page to get some
timestamp information. Since the tool has access to java routines I
was wondering if there is one I could use for this purpose. Searching
the archive I found a thread with the following:

URL url = new URL("http://.......");
URLConnection URLconnect = url.openConnection();
BufferedReader br = new BufferedReader(new
InputStreamReader(URLconnect.getInputStream()))

This gives me hope, but I do not know what the mechanism is for
importing java libs.

Thanks,

jh
NathanIEI - 08 May 2007 21:13 GMT
> Greetings,
>
[quoted text clipped - 17 lines]
>
> jh

If I understand your problem correctly, there is a library I use for
this called HTTPUnit (http://httpunit.sourceforge.net/). This library
is made specifically for unit testing, but can be used for much more.

This library allows you to create a 'WebConversation' which will
maintain a state, get WebResponses which have methods to access forms
(ex getFirstMatchingForm(WebForm.MATCH_NAME, "fooForm") ), methods to
get Elements in the form (or page) (ex.
getElementWithID("fooElement").getText() ), etc..

I've used HttpUnit to build a simple webcrawler (quickly) that i'm
quite happy with...

Nate.
HMS Surprise - 08 May 2007 21:32 GMT
Many thanks Nate.

I have already bookmarked it I will certainly look into this in depth
as soon as the current fire drill is over.

jh


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.