dsebastien / greader-unofficial

Automatically exported from code.google.com/p/greader-unofficial
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Parsing atom information using ROME--meet problem #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Guys:

  I'm using following code to analyse the atom xml content.
  But when run to "syndFeedInput.build(tmp);", an exception occured. It
seems that the format of the xml is not right.(but the xml file is from
google reader)
  Also there are some chinese words in the xml file, but I think it's not
the problem is.
  Please help me to find the real problem.

   Thanks a lot.

--------------------------------------------------------
        public static SyndFeed getAtomFeed(String xmlContent)
                        throws GoogleReaderException {

                try {
                        StringReader tmp = new StringReader(xmlContent);
                        SyndFeedInput syndFeedInput = new SyndFeedInput();
                        return syndFeedInput.build(tmp);
                } catch (IllegalArgumentException e) {
                        throw new GoogleReaderException(
                                        "The provided xml content is not a
valid Atom feed!", e);
                } catch (FeedException e) {
                        throw new GoogleReaderException(
                                        "The provided xml content is not a
valid Atom feed!", e);
                }
        }
--------------------------------------------------------------------------------
----------------

<?xml version="1.0" ?>
<feed xmlns:idx="urn:atom-extension:indexing"
xmlns:gr="http://www.google.com/schemas/reader/atom/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns="http://www.w3.org/2005/Atom" idx:index="no">
- <!-- Content-type: Preventing XSRF in IE.

  -->
  <generator uri="http://www.google.com/reader">Google Reader</generator>
  <id>tag:google.com,2005:reader/user/11079533016622235900/label/时事新闻</id>
  <title>Google 阅读器中通过 xiao 指定的“时事新闻”</title>
  <gr:continuation>COnNhcjkrpoC</gr:continuation>
  <link rel="self"
href="http://www.google.com/reader/atom/user/-/label/%E6%97%B6%E4%BA%8B%E6%96%B0
%E9%97%BB"
/>
 <author>
  <name>xiao</name>
  </author>
  <updated>2009-05-09T10:20:20Z</updated>
<entry gr:crawl-timestamp-msec="1241864420611">
  <id
gr:original-id="http://go.rss.sina.com.cn/redirect.php?url=http://news.sina.com.
cn/c/2009-05-09/180617780236.shtml">tag:google.com,2005:reader/item/64a9952927aa
d22f</id>
  <category term="user/11079533016622235900/state/com.google/reading-list"
scheme="http://www.google.com/reader/" label="reading-list" />
  <category term="user/11079533016622235900/label/时事新闻"
scheme="http://www.google.com/reader/" label="时事新闻" />
  <category term="user/11079533016622235900/state/com.google/fresh"
scheme="http://www.google.com/reader/" label="fresh" />
  <category term="国内要闻" />
  <title type="html">四川旅游局副局长吴勉:四川景点依旧美丽</title>
  <published>2009-05-09T10:06:30Z</published>
  <updated>2009-05-09T10:06:30Z</updated>
  <link rel="alternate"
href="http://go.rss.sina.com.cn/redirect.php?url=http://news.sina.com.cn/c/2009-
05-09/180617780236.shtml"
type="text/html" />
  <summary xml:base="http://news.sina.com.cn/491/2008/0827/1.html"
type="html">  2009年“5・12”汶川特大地震一周年纪念前夕,�
��三联生活周刊》邀请
四川文化名人,深入探讨“四川精神”与“家园重建”。以��
�为四川省旅游局副局长吴勉
的发言: 
  吴勉:四川依然美丽,四川人依然乐观  震后旅游口��
�是“四川依然
美丽”,2009年“天下四川有爱”,....</summary>
- <author>
  <name>WWW.SINA.COM.CN</name>
  </author>
- <source gr:stream-id="feed/http://rss.sina.com.cn/news/china/focus15.xml">

<id>tag:google.com,2005:reader/feed/http://rss.sina.com.cn/news/china/focus15.xm
l</id>
  <title type="html">国内要闻-新浪新闻</title>
  <link rel="alternate" href="http://news.sina.com.cn/491/2008/0827/1.html"
type="text/html" />
  </source>
  </entry>
<entry gr:crawl-timestamp-msec="1241864420611">
  <id
gr:original-id="http://go.rss.sina.com.cn/redirect.php?url=http://news.sina.com.
cn/w/2009-05-09/174517780234.shtml">tag:google.com,2005:reader/item/4b19e4c45ea8
c7d8</id>
  <category term="user/11079533016622235900/state/com.google/reading-list"
scheme="http://www.google.com/reader/" label="reading-list" />
  <category term="user/11079533016622235900/label/时事新闻"
scheme="http://www.google.com/reader/" label="时事新闻" />
  <category term="user/11079533016622235900/state/com.google/fresh"
scheme="http://www.google.com/reader/" label="fresh" />
  <category term="国内要闻" />
  <title type="html">委内瑞拉首都警察局查获大批武器</title>
  <published>2009-05-09T09:45:00Z</published>
  <updated>2009-05-09T09:45:00Z</updated>
  <link rel="alternate"
href="http://go.rss.sina.com.cn/redirect.php?url=http://news.sina.com.cn/w/2009-
05-09/174517780234.shtml"
type="text/html" />
  <summary xml:base="http://news.sina.com.cn/491/2008/0827/1.html"
type="html">  人民网5月9日讯据来自加拉加斯的消息,委内瑞
拉首都警察局局长
梅萨宣布,昨天警方在首都的一次行动中查获大批武器,包��
�大口径枪支和大量弹
药。这些武器弹药属于一个名为 “国际的”犯罪团伙。 
  警方在行动中逮捕了该团
伙的成员3名多米尼加人(两男一女)和法国人弗里德....</summ
ary>
<author>
  <name>WWW.SINA.COM.CN</name>
  </author>
<source gr:stream-id="feed/http://rss.sina.com.cn/news/china/focus15.xml">

<id>tag:google.com,2005:reader/feed/http://rss.sina.com.cn/news/china/focus15.xm
l</id>
  <title type="html">国内要闻-新浪新闻</title>
  <link rel="alternate" href="http://news.sina.com.cn/491/2008/0827/1.html"
type="text/html" />
  </source>
  </entry>
  </feed>

Original issue reported on code.google.com by human2...@gmail.com on 9 May 2009 at 1:51

GoogleCodeExporter commented 9 years ago
Hello there. 

I'm sorry but I won't be able to look into this issue before July. The problem 
is
that my exams are very close and thus I have to concentrate for these.

From what I see in the file, the problem may be caused by the chinese characters
embedded. Probably that the code I've used (from the Rome library) has a 
problem with
that or that the "SyndFeedInput" needs some more configuration.

I'll make sure to try and help you out as soon as I can.

Sébastien.

Original comment by lechtit...@gmail.com on 9 May 2009 at 3:44

GoogleCodeExporter commented 9 years ago
But I have replaced the chinese words with English word, still problem.

Original comment by human2...@gmail.com on 10 May 2009 at 1:12

GoogleCodeExporter commented 9 years ago
Could you send the exception you're getting?

Original comment by lechtit...@gmail.com on 10 May 2009 at 1:55