• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

basic tools needed create substrings

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Java Gurus,

I am trying write a program that will go to a website, grab the html source code, and parse sections out of it. So far I can return the html source code as a giant string. My question is, what basic classes and methods should I learn to scan through this string and eventually save snippets of data?

I've looked at the split and substring methods on the String class. Other tutorials have suggested the use of the Pattern class, scanner class, and matcher classes. Your thoughts?

As always, thanks for your time.
Adam
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adam:

This is a good place to start.

John.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Adam ,

Do you intend to get the HTML and parse it yourself ? I would mark that as Crazy. You might end up with unexpected results and out of memory exceptions and waste some nice time.

Try using some well tested HTML parsers. I would personally recommend

jerichohtml.sourceforge.net

.

It's clean and friendly.

Cheers
Aneesh
 
Adam Confino
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys.
reply
    Bookmark Topic Watch Topic
  • New Topic