How to replace URLs of links using Java HTMLParser
Micheal Marky <[email protected]>
| Newsgroups | gmane.comp.parsers.htmlparser.user |
|---|---|
| Message-ID | <[email protected]> |
How to replace URLs of links using Java HTMLParser <http://stackoverflow.com/questions/1089517/how-to-replace-urls-of-links-using-java-htmlparser-org-htmlparser> I am using htmlparser (htmlparser.org) to re-write all the link's in a input String. All i need to do is iterate over all the link tags (<a href=...), that appear in the input String, grab their value, perform some regex to determine how they should be manipulated, and then update the link's href, target and onclick values accordingly. I am not sure how exactly I can update only the select link elements in the input String, will leaving all other data in the input String untouched. It seems like the htmlparser library can extract certain elements for manipulation but it can't manipulate elements in their original context, and the then return their updated values will maintaining the integrity of the original context. Example : <a class="user" href="">ERIC POWER</a> commented on <a class="user" href="">Test Test</a>'s blog entry, <a href=" http://liferay-sandbox-myview/c/blogs/find_entry?entryId=20801">Dave's Entry To Test DE742</a>, in <a class="group" href=" http://liferay-sandbox-myview/c/my_places/view?groupId=11113&privateLayout=0">Global Platform for Sales</a>. Any help would be greatly appreciated. Thanks Micheal ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Htmlparser-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/htmlparser-user