Unable to read simple RSS feed
up vote
0
down vote
favorite
I have a simple code that reads RSS feeds. It used to work OK with the given RSS feed, but for some reason stopped working with the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid document
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:312)
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:234)
at com.rometools.rome.io.SyndFeedInput.build(SyndFeedInput.java:150)
This is the code:
URL url = new URL("http://www.dpreview.com/feeds/reviews/latest");
XmlReader reader = null;
try
reader = new XmlReader(url);
SyndFeed feeder = new SyndFeedInput().build(reader);
System.out.println("Feed Title: "+ feeder.getAuthor());
for (Iterator i = feeder.getEntries().iterator(); i.hasNext();)
SyndEntry syndEntry = (SyndEntry) i.next();
System.out.println(syndEntry.getTitle());
finally
if (reader != null)
reader.close();
Anything I am missing?
java rss rss-reader
add a comment |
up vote
0
down vote
favorite
I have a simple code that reads RSS feeds. It used to work OK with the given RSS feed, but for some reason stopped working with the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid document
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:312)
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:234)
at com.rometools.rome.io.SyndFeedInput.build(SyndFeedInput.java:150)
This is the code:
URL url = new URL("http://www.dpreview.com/feeds/reviews/latest");
XmlReader reader = null;
try
reader = new XmlReader(url);
SyndFeed feeder = new SyndFeedInput().build(reader);
System.out.println("Feed Title: "+ feeder.getAuthor());
for (Iterator i = feeder.getEntries().iterator(); i.hasNext();)
SyndEntry syndEntry = (SyndEntry) i.next();
System.out.println(syndEntry.getTitle());
finally
if (reader != null)
reader.close();
Anything I am missing?
java rss rss-reader
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a simple code that reads RSS feeds. It used to work OK with the given RSS feed, but for some reason stopped working with the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid document
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:312)
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:234)
at com.rometools.rome.io.SyndFeedInput.build(SyndFeedInput.java:150)
This is the code:
URL url = new URL("http://www.dpreview.com/feeds/reviews/latest");
XmlReader reader = null;
try
reader = new XmlReader(url);
SyndFeed feeder = new SyndFeedInput().build(reader);
System.out.println("Feed Title: "+ feeder.getAuthor());
for (Iterator i = feeder.getEntries().iterator(); i.hasNext();)
SyndEntry syndEntry = (SyndEntry) i.next();
System.out.println(syndEntry.getTitle());
finally
if (reader != null)
reader.close();
Anything I am missing?
java rss rss-reader
I have a simple code that reads RSS feeds. It used to work OK with the given RSS feed, but for some reason stopped working with the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid document
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:312)
at com.rometools.rome.io.WireFeedInput.build(WireFeedInput.java:234)
at com.rometools.rome.io.SyndFeedInput.build(SyndFeedInput.java:150)
This is the code:
URL url = new URL("http://www.dpreview.com/feeds/reviews/latest");
XmlReader reader = null;
try
reader = new XmlReader(url);
SyndFeed feeder = new SyndFeedInput().build(reader);
System.out.println("Feed Title: "+ feeder.getAuthor());
for (Iterator i = feeder.getEntries().iterator(); i.hasNext();)
SyndEntry syndEntry = (SyndEntry) i.next();
System.out.println(syndEntry.getTitle());
finally
if (reader != null)
reader.close();
Anything I am missing?
java rss rss-reader
java rss rss-reader
asked Nov 10 at 20:47
bashan
1,67662748
1,67662748
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Problem with URL. Responds with Object moved to <a href="https://www.dpreview.com/feeds/reviews/latest">here</a>
. That is why exception Invalid document
.
That means that XmlReader
does not support 304 redirects.
So if you fix your URL to https
instead of http
, everything works.
There was similar issue, which says that, you have to deal with redirects your self.
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
1
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you checkXmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.
– muradm
Nov 11 at 15:08
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Problem with URL. Responds with Object moved to <a href="https://www.dpreview.com/feeds/reviews/latest">here</a>
. That is why exception Invalid document
.
That means that XmlReader
does not support 304 redirects.
So if you fix your URL to https
instead of http
, everything works.
There was similar issue, which says that, you have to deal with redirects your self.
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
1
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you checkXmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.
– muradm
Nov 11 at 15:08
add a comment |
up vote
1
down vote
accepted
Problem with URL. Responds with Object moved to <a href="https://www.dpreview.com/feeds/reviews/latest">here</a>
. That is why exception Invalid document
.
That means that XmlReader
does not support 304 redirects.
So if you fix your URL to https
instead of http
, everything works.
There was similar issue, which says that, you have to deal with redirects your self.
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
1
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you checkXmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.
– muradm
Nov 11 at 15:08
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Problem with URL. Responds with Object moved to <a href="https://www.dpreview.com/feeds/reviews/latest">here</a>
. That is why exception Invalid document
.
That means that XmlReader
does not support 304 redirects.
So if you fix your URL to https
instead of http
, everything works.
There was similar issue, which says that, you have to deal with redirects your self.
Problem with URL. Responds with Object moved to <a href="https://www.dpreview.com/feeds/reviews/latest">here</a>
. That is why exception Invalid document
.
That means that XmlReader
does not support 304 redirects.
So if you fix your URL to https
instead of http
, everything works.
There was similar issue, which says that, you have to deal with redirects your self.
answered Nov 10 at 21:10
muradm
732419
732419
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
1
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you checkXmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.
– muradm
Nov 11 at 15:08
add a comment |
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
1
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you checkXmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.
– muradm
Nov 11 at 15:08
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
Thanks @muradm. I wonder why the framework doesn't follow redirects... should be a common use case with RSS feeds...
– bashan
Nov 11 at 14:49
1
1
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you check
XmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.– muradm
Nov 11 at 15:08
As it says in documentation, it works with feeds, but is not focused on transport. It includes very basic http client. If you check
XmlReader
it can read from different sources including streams. So you can plug any type of data source there, like more advanced http client, or some other implementation, exaggerating websocket, raw tcp/ip, database etc.– muradm
Nov 11 at 15:08
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243251%2funable-to-read-simple-rss-feed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown