开发者

Android XML Rich Text Processing

I used the tutorial listed here to parse my XML:

http://android-er.blogspot.com/2010/05/simple-rss-reader-iii-show-details-once.html

The problem I am having is when I try to read in the XML description tag all I get is this:

Android XML Rich Text Processing

The "<" symbol is where the description s开发者_JAVA百科hould go. This is the feed I am reading: http://www.calvaryccm.com/rss/devos.ashx

Please help me solve my issue in getting the real text into the description. Thank you!


I just created an android project in eclipse using the code I downloaded from the site you listed above. I only made one modification to the original sources. I changed line 33 in AndroidRssReader.java to read:

            URL rssUrl = new URL("http://www.calvaryccm.com/rss/devos.ashx");

The feed loads and parses fine.

Android XML Rich Text Processing

The parsing error is the result of changes you made to the original sources.


If the data is html encoded, you can use one of the following methods -- or if it is unencoded, you can surround the content in CDATA tags.

Spanned spannedContent = Html.fromHtml(htmlString);
textView.setText(spannedContent, BufferType.SPANNABLE);

or

WebView webview = (WebView) findViewById(R.id.aWebView);
String htmlString = "<html><body>Some html</body></html>";
webview.loadData(htmlString, "text/html", "utf-8");


I found out that I need to wrap my RSS tags in CDATA Tags as shown here:

Writing input for .NET web services

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜