• Post Reply Bookmark Topic Watch Topic
  • New Topic

reading a HTML page as stream  RSS feed

 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was wondering how do I read a HTML page as some kind of Stream that I can parse with StringTokenizer or saved as a HTML page in my local drive?
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a Java program which makes a url connection to the site that has the page. You create an inputstream off the URLConnection object and read in the html. From there you can parse it using whatever you wish but, I suggest the javax.swing.text.html.HTMLEditorKit.Parser You can read about the functionality in the API's.
Hope this helps
 
gautham kasinath
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! der!
Well I d like to know how to set up an URL Connection and hot to read de data coming in..
More over thru socket connection U can read a HTML page or data associated in HTML / XML format as simply as reading a string.. on the sender side use dataoutputstreamobject.writeBytes(String)
and on the Receiver side use dataInputStreamObject.readLine() make sure U give a new line chaeracter and a outputStreamObject.flush() when sending.
Regds
Gautham Kasinath
U R not Alone
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Custom Networking Tutorial can get you started. If you have specific questions after that, I'll gladly help you
 
gautham kasinath
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! Well tanx a lot dat really was a lotta help..
Regds
Gautham Kasinath
U R Not Alone
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!