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?










share|improve this question

























    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?










    share|improve this question























      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?










      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 20:47









      bashan

      1,67662748




      1,67662748






















          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.






          share|improve this answer




















          • 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 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











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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

























          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.






          share|improve this answer




















          • 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 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















          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.






          share|improve this answer




















          • 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 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













          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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 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

















          • 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 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
















          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


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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





















































          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







          這個網誌中的熱門文章

          Barbados

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3