• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Scanning HTML page for HREF AND IMG tags

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does any body how i could scan an entire html page and look for href and img tags and change some text in the tags.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a servlet? How would the servlet get the HTML page?

In any case, once you have the HTML source in a string, you'll either need to parse the HTML or (easier) scan the text using regular expressions. As this is not a Servlet issue, it's been moved off the the general forum.
[ April 24, 2008: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actual Possible Question #1 - I am developing a web site and I don't know how to use the Find command of my IDE to change some href and image tags.

Actual Possible Question #2 - I am trying to "borrow" work that someone else has already done and make it appear as my own by changing some text in the links and images.

Actual Possible Question #3 - I am trying to scrape porn sites for images. How do I do that?

I crack myself up.
 
Sheriff
Posts: 22818
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out javax.swing.text.html.ParserDelegator. This will find a parser for you, so let it do the dirty work.

Here's some example code:
 
Always! Wait. Never. Shut up. Look at this tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic