當前位置: 首頁>>代碼示例>>Java>>正文


Java StringEscapeUtils.unescapeHtml4方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4方法的典型用法代碼示例。如果您正苦於以下問題:Java StringEscapeUtils.unescapeHtml4方法的具體用法?Java StringEscapeUtils.unescapeHtml4怎麽用?Java StringEscapeUtils.unescapeHtml4使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.StringEscapeUtils的用法示例。


在下文中一共展示了StringEscapeUtils.unescapeHtml4方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createInstance

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
/**
 * Creates a new chat instance.
 * 
 * @return The unique id that identifies the created instance
 */
public String createInstance() {
	final String query = this.mServiceUrl + CREATE_REQUEST;
	try {
		final List<String> content = getWebContent(query);
		// If the answer is empty there was some error
		if (content.isEmpty()) {
			return null;
		}

		// The first line contains the id
		final String firstLine = content.iterator().next();
		if (firstLine.trim().isEmpty()) {
			return null;
		}
		return StringEscapeUtils.unescapeHtml4(firstLine);
	} catch (final IOException e) {
		// Ignore the exception and return null
		return null;
	}
}
 
開發者ID:ZabuzaW,項目名稱:BrainBridge,代碼行數:26,代碼來源:BrainBridgeAPI.java

示例2: getTitle

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public final String getTitle(String s) {
  int start = s.indexOf(XML_START_TAG_TITLE);
  int end = s.indexOf(XML_END_TAG_TITLE, start);
  if (start < 0 || end < 0) {
    return "";
  }
  return StringEscapeUtils.unescapeHtml4(s.substring(start + 7, end));
}
 
開發者ID:asmehra95,項目名稱:wiseowl,代碼行數:9,代碼來源:WikiClean.java

示例3: clean

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public String clean(String content) {
  //String content = getWikiMarkup(page);
  content = removeRefs(content);
  content = removeInterWikiLinks(content);
  content = removeParentheticals(content);
  content = fixUnitConversion(content);
  content = ImageCaptionsRemover.remove(content);
  content = DoubleBracesRemover.remove(content);
  content = removeHtmlComments(content);
  content = removeEmphasis(content);
  content = removeHeadings(content);
  content = removeCategoryLinks(content);
  content = removeLinks(content);
  content = removeMath(content);
  content = removeGallery(content);
  content = removeNoToc(content);
  content = removeIndentation(content);

  content = TableRemover.remove(content);

  // For some reason, some HTML entities are doubly encoded.
  content = StringEscapeUtils.unescapeHtml4(StringEscapeUtils.unescapeHtml4(content));
  content = removeHtmlTags(content);

  // Finally, fold multiple newlines.
  content = compressMultipleNewlines(content);
  return content.trim().replaceAll("\\n+", " ");
}
 
開發者ID:asmehra95,項目名稱:wiseowl,代碼行數:29,代碼來源:WikiClean.java

示例4: getLastMessage

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
/**
 * Gets the last answer of the chat bot for the instance with the given id.
 * 
 * @param id
 *            The id of the instance
 * @return The last answer of the chat bot for the given instance or
 *         <tt>null</tt> if there was no or the server experienced an error
 */
public String getLastMessage(final String id) {
	final String query = this.mServiceUrl + GET_MESSAGE_REQUEST + ID_PARAMETER + id;
	try {
		final List<String> content = getWebContent(query);
		// If the answer is empty there was some error
		if (content.isEmpty()) {
			return null;
		}

		// The first line contains the message
		final String firstLine = content.iterator().next();
		if (firstLine.trim().isEmpty()) {
			return null;
		}
		return StringEscapeUtils.unescapeHtml4(firstLine);
	} catch (final IOException e) {
		// Ignore the exception and return null
		return null;
	}
}
 
開發者ID:ZabuzaW,項目名稱:BrainBridge,代碼行數:29,代碼來源:BrainBridgeAPI.java

示例5: defaultShareText

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public static void defaultShareText(String title, String url, Context c) {
    url = StringEscapeUtils.unescapeHtml4(Html.fromHtml(url).toString());
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    /* Decode html entities */
    title = StringEscapeUtils.unescapeHtml4(title);
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title);
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, url);
    c.startActivity(Intent.createChooser(sharingIntent, c.getString(R.string.title_share)));
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:11,代碼來源:MainActivity.java

示例6: defaultShare

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public static void defaultShare(String url, Context c) {
    url = StringEscapeUtils.unescapeHtml4(Html.fromHtml(url).toString());
    Uri webpage = LinkUtil.formatURL(url);
    Intent intent = new Intent(Intent.ACTION_VIEW, webpage);
    if (intent.resolveActivity(c.getPackageManager()) != null) {
        c.startActivity(intent);
    }
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:9,代碼來源:MainActivity.java

示例7: pushFlashNotification

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public void pushFlashNotification(Flash flash) throws JSONException, IOException {
    if (!prefs.getBoolean("notifications_enabled", true)) {
        return;
    }
    Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(flash.getLink()));
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    String text = StringEscapeUtils.unescapeHtml4(flash.getText());
    NotificationManager mNotificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
        Notification.Builder oBuilder = new Notification.Builder(context, getNotificationChannel(context).getId());
        oBuilder.setContentTitle(flash.getChannel() + " • " + flash.getSource())
                .setStyle(new Notification.BigTextStyle()
                        .bigText(text))
                .setContentText(text)
                .setAutoCancel(true)
                .setSound(Uri.parse(prefs.getString("notification_sound", "DEFAULT")))
                .setContentIntent(pendingIntent)
                .setSmallIcon(R.drawable.ic_alert);
        mNotificationManager.notify(flash.getIdAsInteger(), oBuilder.build());
    }else{
        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                .setContentTitle(flash.getChannel() + " • " + flash.getSource())
                .setStyle(new NotificationCompat.BigTextStyle()
                        .bigText(text))
                .setContentText(text)
                .setAutoCancel(true)
                .setSound(Uri.parse(prefs.getString("notification_sound", "DEFAULT")))
                .setContentIntent(pendingIntent);
        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            mBuilder.setSmallIcon(R.drawable.ic_alert);
        } else {
            mBuilder.setSmallIcon(R.drawable.ic_alert_compat);
        }
        mNotificationManager.notify(flash.getIdAsInteger(), mBuilder.build());
    }
}
 
開發者ID:milesmcc,項目名稱:LibreNews-Android,代碼行數:38,代碼來源:FlashManager.java

示例8: format

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public static String format(String content, Map<String, String> props) {
    Matcher m = PATTERN.matcher(Pattern.quote(content));
    String result = content;
    while (m.find()) {
        String found = m.group(1);
        String newVal = props.getOrDefault(found.trim(), "null");

        String escaped = StringEscapeUtils.escapeHtml4(newVal);
        result = result.replaceFirst(REGEX, Matcher.quoteReplacement(escaped));
    }
    return StringEscapeUtils.unescapeHtml4(result);
}
 
開發者ID:Asymmetrik,項目名稱:nifi-nars,代碼行數:13,代碼來源:CreateContent.java

示例9: unescapeHtml

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
/**
 * Html 解碼.
 */
public static String unescapeHtml(String htmlEscaped) {
	return StringEscapeUtils.unescapeHtml4(htmlEscaped);
}
 
開發者ID:funtl,項目名稱:framework,代碼行數:7,代碼來源:Encodes.java

示例10: unescapeHtml

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
/**
 * Html 解碼.
 */
public static String unescapeHtml(String htmlEscaped) {
    return StringEscapeUtils.unescapeHtml4(htmlEscaped);
}
 
開發者ID:NeilRen,項目名稱:NEILREN4J,代碼行數:7,代碼來源:Encodes.java

示例11: parse

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public static JsonLdArticle parse(List<String> jsons) {
    try {
        for (String jsonLd : jsons) {
            if (!Strings.isNullOrEmpty(jsonLd)) {
                jsonLd = jsonLd.replaceAll("http://www\\.schema\\.org", "http://schema.org");
                jsonLd = jsonLd.replaceAll("\"http://schema\\.org\"", "\"http://schema.org/\"");
                Object jsonObject = JsonUtils.fromString(jsonLd);
                Map<String, Object> data = JsonLdProcessor.compact(jsonObject, new HashMap(), new JsonLdOptions());
                String type = Objects.toString(data.get("@type"), null);
                if (type == null && data.get(SCHEMA_ATTR_ARTICLE) instanceof Map) {
                    data = (Map<String, Object>) data.get(SCHEMA_ATTR_ARTICLE);
                    type = Objects.toString(data.get("@type"), null);
                }
                if (SCHEMA_CLASS_ARTICLE.equalsIgnoreCase(type) || SCHEMA_CLASS_NEWS_ARTICLE.equalsIgnoreCase(type)) {
                    JsonLdArticle article = new JsonLdArticle();
                    String headline = Objects.toString(data.get(SCHEMA_ATTR_HEADLINE), null);
                    if (!Strings.isNullOrEmpty(headline)) {
                        headline = StringEscapeUtils.unescapeHtml4(headline);
                    }
                    article.setHeadline(headline);
                    String articleBody = Objects.toString(data.get(SCHEMA_ATTR_ARTICLE_BODY), null);
                    if (!Strings.isNullOrEmpty(articleBody)) {
                        articleBody = StringEscapeUtils.unescapeHtml4(articleBody);
                    }
                    article.setArticleBody(articleBody);
                    Object publishedObject = data.get(SCHEMA_ATTR_PUBLISHED);
                    String datePublished = null;
                    if (publishedObject instanceof String) {
                        datePublished = (String) publishedObject;
                    } else if (publishedObject instanceof Map) {
                        datePublished = Objects.toString(((Map) publishedObject).get("@value"), null);
                    }
                    article.setDatePublished(datePublished);
                    return article;
                }
            }
        }
    } catch (Exception e) {
        LOG.warn("Failed to parse ld+json", e);
    }
    return null;
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:43,代碼來源:JsonLdParser.java

示例12: unescapeHtml

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public static String unescapeHtml(String text) {
    return StringEscapeUtils.unescapeHtml4(text);
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:4,代碼來源:StringUtils.java

示例13: unEscapeString

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
public static String unEscapeString(String stringToUnEscape) {
    return StringEscapeUtils.unescapeHtml4(stringToUnEscape);
}
 
開發者ID:klask-io,項目名稱:klask-io,代碼行數:4,代碼來源:EncodingUtil.java

示例14: fromHtml

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
/**
    * 
    * Converts special HTML values of characters to their original values. <br>
    * Example : <code>"&amp;eacute;"</code>"is converted to "�"
    * <p>
    * 
    * @param string
    *            A String to convert from HTML to original
    *            <p>
    * @return A String of char converted to original values
    * 
    */

   public static String fromHtml(String string) {

if (DO_NOTHING) return string;

if (string == null) return string;
    
if (string.contains("&")) {
    return StringEscapeUtils.unescapeHtml4(string);
} else {
    return string;
}

   }
 
開發者ID:kawansoft,項目名稱:aceql-http,代碼行數:27,代碼來源:HtmlConverter.java

示例15: unescapeHtml

import org.apache.commons.lang3.StringEscapeUtils; //導入方法依賴的package包/類
/**
 * Html解碼,將HTML4格式的字符串轉碼解碼為普通字符串.
 * 
 * 比如 &quot;bread&quot; &amp; &quot;butter&quot;轉化為"bread" & "butter"
 */
public static String unescapeHtml(String html) {
	return StringEscapeUtils.unescapeHtml4(html);
}
 
開發者ID:zhangjunfang,項目名稱:util,代碼行數:9,代碼來源:EscapeUtil.java


注:本文中的org.apache.commons.lang3.StringEscapeUtils.unescapeHtml4方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。