From cca2fb9a420faecbbfece396d365cf2751b91282 Mon Sep 17 00:00:00 2001 From: mishako Date: Mon, 10 Oct 2016 22:58:24 +0200 Subject: [PATCH] Add code examples to readme --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 489a536..8afca64 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,24 @@ ROME is a Java framework for RSS and Atom feeds. The framework consist of severa | `rome-opml` | [OPML](https://en.wikipedia.org/wiki/OPML) parsers and tools. | Deprecated modules: `rome-fetcher`, `rome-certiorem`, `rome-certiorem-webapp` and `rome-propono`. + +## Examples + +Parse a feed: + +```java +String url = "http://stackoverflow.com/feeds/tag?tagnames=rome"; +SyndFeed feed = new SyndFeedInput().build(new XmlReader(new URL(url))); +System.out.println(feed.getTitle()); +``` + +Generate a feed: + +```java +SyndFeed feed = new SyndFeedImpl(); +feed.setFeedType("rss_2.0"); +feed.setTitle("test-title"); +feed.setDescription("test-description"); +feed.setLink("https://example.org"); +System.out.println(new SyndFeedOutput().outputString(feed)); +```