Example usage for org.apache.commons.lang3 StringEscapeUtils unescapeHtml4

List of usage examples for org.apache.commons.lang3 StringEscapeUtils unescapeHtml4

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringEscapeUtils unescapeHtml4.

Prototype

public static final String unescapeHtml4(final String input) 

Source Link

Document

Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes.

Usage

From source file:com.qwazr.utils.HtmlUtils.java

public static void main(String args[]) throws IOException {
     if (args != null && args.length == 2) {
         List<String> lines = FileUtils.readLines(new File(args[0]));
         FileWriter fw = new FileWriter(new File(args[1]));
         PrintWriter pw = new PrintWriter(fw);
         for (String line : lines)
             pw.println(StringEscapeUtils.unescapeHtml4(line));
         pw.close();//from w  ww.j  a  v  a  2  s .  c om
         fw.close();
     }
     String text = "file://&shy;Users/ekeller/Moteur/infotoday_enterprisesearchsourcebook08/Open_on_Windows.exe";
     System.out.println(htmlWrap(text, 20));
     System.out.println(htmlWrapReduce(text, 20, 80));
     String url = "file://Users/ekeller/Moteur/infotoday_enterprisesearchsourcebook08/Open_on_Windows.exe?test=2";
     System.out.println(urlHostPathWrapReduce(url, 80));
 }

From source file:com.Sanish.automatedserver.filter.MeaningFilter.java

public static String filter(String content) {
    content = StringEscapeUtils.unescapeHtml4(content);
    content = content.replace(";", "");
    content = content.replace("<br/>", "\n");
    content = content.replaceAll("<a href(.*?)>", "");
    content = content.replaceAll("</a>", "");
    return content;

}

From source file:com.sharpshim.yarc.util.HtmlUtil.java

public static String stripHtml(String html) {
    if (html == null)
        return "";
    Matcher matcher = scriptPattern.matcher(html);
    html = matcher.replaceAll("");
    matcher = hiddenPattern.matcher(html);
    html = matcher.replaceAll("");
    html = html.replaceAll("\\<.*?\\>", "");
    html = StringEscapeUtils.unescapeHtml4(html);
    html = html.replaceAll("[\n]+", "\n");
    html = clearString(html);//from   w  w w.  j a  va2s .  c  om
    return html.trim();
}

From source file:de.randec.MVBMonitor.Downloader.java

static String downloadJson(String url) throws IOException {
    String data = "";
    try {//from   ww w.  j  a  va2s.  c  o  m
        // defaultHttpClient
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);
        HttpResponse response = httpClient.execute(httpPost);
        data = EntityUtils.toString(response.getEntity(), "utf-8");
        //data = EntityUtils.toString(response.getEntity());
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    }
    //unescape escape codes (Umlaute)
    return StringEscapeUtils.unescapeHtml4(data);

}

From source file:com.wellsandwhistles.android.redditsp.reddit.things.RedditMessage.java

public String getUnescapedBodyMarkdown() {
    return StringEscapeUtils.unescapeHtml4(body);
}

From source file:at.tugraz.sss.serv.SSMediaWikiU.java

public static String wikiContent(String xmlString) {

    int startIndex = xmlString.indexOf(revStart);
    int endIndex = xmlString.indexOf(revEnd);

    if (startIndex != -1 && endIndex != -1) {
        return StringEscapeUtils.unescapeHtml4(xmlString.substring(startIndex + revEnd.length(), endIndex));
    }// w w  w.j  a va  2 s  .  c o m

    return null;
}

From source file:com.ewcms.util.HtmlStringUtil.java

public static String htmlDecode(String txt) {
    txt = replaceEx(txt, "&#8226;", "\267");
    return StringEscapeUtils.unescapeHtml4(txt);
}

From source file:de.vanita5.twittnuker.util.HtmlEscapeHelper.java

public static String unescape(final String string) {
    if (string == null)
        return null;
    return StringEscapeUtils.unescapeHtml4(string);
}

From source file:com.github.breadmoirai.samurai.util.SearchResult.java

private static String cleanString(String uncleanString) {
    return StringEscapeUtils.unescapeJava(StringEscapeUtils
            .unescapeHtml4(uncleanString.replaceAll("\\s+", " ").replaceAll("<.*?>", "").replaceAll("\"", "")));
}

From source file:es.ait.gp.web.util.jsf.HTMLTextConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    return StringEscapeUtils.unescapeHtml4(value.replaceAll("<br/>", "\n"));
}