Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read from html file, get a copy of the html text and modify img tags src

 
cle tan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Main reason is that I want to send these html and its images attached via javamail. I can send the html file but I need to grab hold of the images to attach


The images can vary up to 3, I have considered using HTMLReader for example : http://www.coderanch.com/t/385274/java/java/Scanning-HTML-page-HREF-IMG

and http://jtoee.blogspot.sg/2007/11/parsing-html-with-htmleditorkitparserca.html

to read the content, and I am considering to get a copy(not modify the actual html file)

instead of

I will like to get a copy of the htmlcontent, replace the first image img src='xxx' with image src='cid:image1',second image image src='cid:image2' and so on.
 
K. Tsang
Bartender
Posts: 3443
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your goal is to get the img tags, it doesn't matter if you get a copy first or reading directly. At the end you still need to parse or read the file. And once you do get the image tag, save it in some collection for your javamail program or email message.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic