Search in sources :

Example 6 with XmlReader

use of com.rometools.rome.io.XmlReader in project rssriver by dadoonet.

the class RssToJsonTest method buildEntry.

private SyndEntryImpl buildEntry() throws FeedException, IOException {
    SyndFeedInput input = new SyndFeedInput();
    SyndFeed feed = input.build(new XmlReader(getClass().getResource("/reuters/rss.xml")));
    return (SyndEntryImpl) feed.getEntries().get(0);
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) SyndFeedInput(com.rometools.rome.io.SyndFeedInput) SyndEntryImpl(com.rometools.rome.feed.synd.SyndEntryImpl) XmlReader(com.rometools.rome.io.XmlReader)

Example 7 with XmlReader

use of com.rometools.rome.io.XmlReader in project rssriver by dadoonet.

the class RssToJsonTest method shouldHaveRawContent.

@Test
public void shouldHaveRawContent() throws Exception {
    SyndFeedInput input = new SyndFeedInput();
    SyndFeed feed = input.build(new XmlReader(getClass().getResource("/dcrainmaker/rss.xml")));
    assertThat(feed.getEntries().size(), greaterThan(0));
    for (Object o : feed.getEntries()) {
        SyndEntryImpl message = (SyndEntryImpl) o;
        XContentBuilder xcb = toJson(message, null, null, true);
        assertThat(xcb, notNullValue());
        assertThat(xcb.string(), containsString("<p>"));
        logger.info(xcb.string());
    }
}
Also used : SyndFeed(com.rometools.rome.feed.synd.SyndFeed) SyndFeedInput(com.rometools.rome.io.SyndFeedInput) SyndEntryImpl(com.rometools.rome.feed.synd.SyndEntryImpl) XmlReader(com.rometools.rome.io.XmlReader) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) Test(org.junit.Test)

Aggregations

SyndFeed (com.rometools.rome.feed.synd.SyndFeed)7 SyndFeedInput (com.rometools.rome.io.SyndFeedInput)7 XmlReader (com.rometools.rome.io.XmlReader)7 SyndEntryImpl (com.rometools.rome.feed.synd.SyndEntryImpl)5 Test (org.junit.Test)5 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)3 GeoRSSModule (com.rometools.modules.georss.GeoRSSModule)1 Position (com.rometools.modules.georss.geometries.Position)1 Channel (com.rometools.rome.feed.rss.Channel)1 FeedException (com.rometools.rome.io.FeedException)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 SubstringMatcher (org.hamcrest.core.SubstringMatcher)1