哎喲,約3小時挖掘和分析你的源代碼後,我發現你爲什麼有這樣一個奇怪的結果,像上面的原因。
首先看看來自鏈接的RSS內容你解析:http://app.calvaryccm.com/mobile/android/v1/devos
其內容的某些部分:
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0"> <channel> <title>CCM Daily Devotions</title> <link>http://www.calvaryccm.com/resources/dailydevotions.aspx</link> <description>Calvary Chapel Melbourne's Daily Devotionals</description> <webMaster>[email protected] (Calvary Chapel Melbourne)</webMaster> <copyright>(c)2011, Calvary Chapel Melbourne. All rights reserved</copyright> <ttl>60</ttl> <item> <guid isPermaLink="false">b3e91cbf-bbe9-4667-bf4c-8ff831ba09f1</guid>
<title>Teachable Moments</title> <description>Based on &ldquo;Role Models, Part 4&rdquo; by Pastor Mark Balmer; 10/8-9/11, Message #6078; Daily Devotional #6 - &ldquo;Teachable Moments&rdquo; Preparing the Soil (Introduction): My husband and I took seriously our understanding of God&rsquo;s instructions to teach His commandments to our children. (Deuteronomy 6:7) We went to our local Christian bookstore and bought children&rsquo;s Bibles, studies, coloring books, games&mdash;anything that would help us to communicate biblical situations in their lives. Planting and Watering the Seed (Growth): Each parent needs to take seriously God&rsquo;s commthe Crop (Action/Response): Life is God&rsquo;s classroom for teachable moments. A long delay in traffic can be a frustrating irritation, or it can be an opportunity to teach our children that God&rsquo;s than taught. Cultivating (Additional Reading): Psalm 78:1-8;&nbsp;Psalm 145:4 klw Calvary Chapel of Melbourne; 2955 Minton Road; W. Melbourne, FL 32904; 321-952-9673 NLT = New Living Translation. </description> <link>http://www.calvaryccm.com/resources/dailydevotions.aspx</link> <pubDate>Sun, 16 Oct 2011 12:00:00 GMT</pubDate> </item>
注重緊密合作,以這個標籤/rss/channel/item/description
,你能看到的是這些東西:rsquo;
或'squo;
或&
或ldquo;
或rdquo;
...這些是轉義字符(左單引號,右單引號,&符號,右雙引號,左雙引號e引用...甚至是新行),它們都駐留在XML內容中。
所以當XML Parser
通過這些字符時,它認爲要逃避解析,這會導致你現在面臨的怪異結果。
解決方案如何?起初,我可以考慮首先獲取URL
的內容,然後使用這些字符(添加SLASH字符),現在我認爲您可以再次成功解析它。
但是,這種解決方案似乎工作得很好,但我認爲它可能不會,因爲來自服務器的RSS文本內容響應格式很奇怪(格式不正確)。因此,如果您可以聯繫此Web管理員,請在發佈RSS訂閱前告訴他們很好地格式RSS content
(如添加SLASH以轉義字符,刪除所有NEW-LINE字符...)。
其他的解決方案是使用手柄逃避某些第三方/轉義東西像StringEscapeUtils
從Apache Commons
:http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringEscapeUtils.html或JTidy
。
但我不認爲這些庫在你的情況下效果最好。
這就是我所能說的。
@ p/s:對您的源代碼只是一些評論,我認爲您需要考慮清楚您的代碼以便閱讀,更好地進行維護,並適當重新打包。
您是否使用與示例相同的代碼?如果您編輯了代碼,請在此處提供。 –
你想從描述標籤中得到什麼值?和任何其他值 –
「對不起,此下載鏈接不再存在」....來自http:// justbeamit.com/95152' –