Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String parseAdvisory(String html) {
- if(html == null || StringUtils.isEmpty(html)) {
- return "";
- }
- String result = html;
- Document doc = Jsoup.parse(html);
- Elements select = doc.select("a[href]");
- result = Jsoup.clean(html, Whitelist.simpleText());
- for(Element currElement: select) {
- String url = currElement.attr("abs:href");
- String urlText = select.text();
- result = result.replaceAll(urlText, urlText + " (" + url + ")");
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement