aspose file tools*
The moose likes Java in General and the fly likes Read from html file, get a copy of the html text and modify img tags src Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Read from html file, get a copy of the html text and modify img tags src" Watch "Read from html file, get a copy of the html text and modify img tags src" New topic
Author

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

cle tan
Ranch Hand

Joined: Jun 11, 2012
Posts: 68
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

Joined: Sep 13, 2007
Posts: 2596
    
    9

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.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read from html file, get a copy of the html text and modify img tags src