久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

刪除android中的html標(biāo)簽

remove html tag in android(刪除android中的html標(biāo)簽)
本文介紹了刪除android中的html標(biāo)簽的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有以下 XML 提要:

I have follows below XML feed:

<Description>
  <p>Touch, tap, flip, slide! You don&#39;t just read Books, you experience it.</p>
</Description>

這里我必須顯示類似

觸摸、點(diǎn)擊、翻轉(zhuǎn)、滑動(dòng)!你不 39.just read the Books, you experience it.

在這里我處理了解析器:

Here I have handled the parser like:

   public static String removeHTML(String htmlString)
  {
  // Remove HTML tag from java String    
String noHTMLString = htmlString.replaceAll("\<.*?\>", "");

// Remove Carriage return from java String
noHTMLString = noHTMLString.replaceAll("
", "<br/>");
noHTMLString = noHTMLString.replaceAll("<([bip])>.*?</1>", "");
// Remove New line from java string and replace html break
noHTMLString = noHTMLString.replaceAll("
", " ");
noHTMLString = noHTMLString.replaceAll(""", "&quot;");
noHTMLString = noHTMLString.replaceAll("<(.*?)\>"," ");//Removes all items in brackets
noHTMLString = noHTMLString.replaceAll("<(.*?)\
"," ");//Must be undeneath
noHTMLString = noHTMLString.replaceFirst("(.*?)\>", " ");
noHTMLString = noHTMLString.replaceAll("&nbsp;"," ");
noHTMLString = noHTMLString.replaceAll("&amp;"," ");
return noHTMLString;

    }

在 endElement 中:

In endElement :

   public void endElement(String uri, String localName, String qName)throws SAXException {
  currentElement = false;
   if (localName.equalsIgnoreCase("Description")){
   sitesList.setDescription(currentValue);
   String Sub_arry=n+currentValue;
   Appscontent.Sub_arraylistdes.add(Sub_arry);
   String stringWithoutHTML=removeHTML(currentValue);
   System.out.println("description value----->"+n+att_ID+"------>>"+stringWithoutHTML);}

現(xiàn)在我必須運(yùn)行該應(yīng)用程序,這意味著 html 標(biāo)記與我的描述一起顯示...在這里如何刪除 HTML 標(biāo)記?請為我提供解決方案???

Now i have to run the app means the html tag is displayed with my description...Here how can I remove the HTML tag? please provide me solution for these ???

我希望顯示沒有 Html 標(biāo)記的描述...請為這些提供解決方案.

i wish to display the description without Html tags...please provide e solution for these.

    if (localName.equalsIgnoreCase("Description")){
    sitesList.setDescription(currentValue);
    String Sub_arry=n+currentValue;
    StringBuffer sb = new StringBuffer();
    sb.append(Sub_arry);
     String newString = sb.toString();
      Appscontent.Sub_arraylistdes.add(newString);
       System.out.println("description value----->"+n+att_ID+"------>>"+newString);}

  public static String html2text(String html) {
  return Jsoup.parse(html).text();
    }

在 endElement:

In endElement:

    if (localName.equalsIgnoreCase("Description")){
    sitesList.setDescription(currentValue);
    String Sub_arry=n+currentValue;
    Appscontent.Sub_arraylistdes.add(Sub_arry);
      String stringWithoutHTML=html2text(currentValue);
       System.out.println("description value----->"+n+att_ID+"------>>"+stringWithoutHTML);}

但我沒有得到 o/p..請為我提供解決方案???如何刪除這些描述中的 html 標(biāo)簽...

But i didn't get the o/p..pls provide me solution for these ??? how can i remove the html tags in these description...

推薦答案

您可以使用 Android 中內(nèi)置的 HTML 類輕松刪除 Android 中的任何 HTML 標(biāo)簽.導(dǎo)入 android.text.Html;.現(xiàn)在,考慮到數(shù)據(jù)"是具有 HTML 標(biāo)記的字符串變量,您可以使用 Html.fromHtml(data).toString() 來取回沒有任何 HTML 標(biāo)記的字符串.

You can easily remove any HTML tag in Android using the built-in HTML class in Android. Import android.text.Html;. Now, considering "data" is your String variable which has HTML tags, you use Html.fromHtml(data).toString() to get back the string without any HTML tags.

這篇關(guān)于刪除android中的html標(biāo)簽的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Upload progress listener not fired (Google drive API)(上傳進(jìn)度偵聽器未觸發(fā)(Google 驅(qū)動(dòng)器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅(qū)動(dòng)api服務(wù)賬戶查看上傳文件到谷歌驅(qū)動(dòng)使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務(wù)帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: 国产欧美视频一区二区 | 国产精品永久 | 日韩精品免费 | 99re99| 精品国产第一区二区三区 | 一级黄a视频| 97久久精品午夜一区二区 | 国产精品.xx视频.xxtv | 成人三级在线观看 | 欧美色性 | 久久免费国产 | 成年人免费在线视频 | 黑人巨大精品欧美一区二区一视频 | 天堂影院av | 毛色毛片免费看 | 欧美黑人国产人伦爽爽爽 | 国产99久久精品一区二区永久免费 | 一级一级毛片免费看 | 欧美激情五月 | 亚洲成av人影片在线观看 | 国产免费观看一级国产 | 精品欧美激情在线观看 | 中国xxxx性xxxx产国 | 91精品久久久久久久久中文字幕 | 亚洲欧美精品在线 | 久久噜噜噜精品国产亚洲综合 | 一区二区电影网 | 91久久国产 | 欧美精品a∨在线观看不卡 国产精品久久国产精品 | 日韩视频一区在线观看 | 一区二区在线观看av | 狠狠ri| 无码国模国产在线观看 | 午夜看片网站 | 午夜影院在线视频 | 亚洲精品欧美精品 | 色综合天天天天做夜夜夜夜做 | 亚洲一区免费 | 国产1区在线 | 欧美在线一级 | 国产yw851.c免费观看网站 |