Re: BSF4REXX implementation of Java fragment



Hi Raetus,

here is a slightly edited version:

- adds comments about the jar-packages one needs to run this program
- does not import the Java classes, but rather instantiates them via the .BSF class

--------------- cut here --------------
/* needs: - ROME, <https://rome.dev.java.net/> states as of 2008-06-05:

"ROME is an set of open source Java tools for parsing, generating and
publishing RSS and Atom feeds. The core ROME library depends only on the
JDOM XML parser and supports parsing, generating and converting all of the
popular RSS and Atom formats including RSS 0.90, RSS 0.91 Netscape, RSS
0.91 Userland, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3,
and Atom 1.0. You can parse to an RSS object model, an Atom object model
or an abstract SyndFeed model that can model either family of formats."

- JDOM, <http://jdom.org>
*/

parse source system . programname
parse version IPversion

if Arg()>0 then
parse arg inURL /* Pick up URL */
else do
say ""
say "FeedReader reads and prints info on any RSS/Atom feed."
say "The first parameter must be the URL of the feed to read."
say ""
exit (8)
end

/* main program */

call SysDropFuncs /* remove if you don't want to deregister */
/* RexxUtil functions */

call bsf.cls /* get ooRexx support for BSF */
s = bsf.loadClass("java.lang.System") /* get the Java class object */
/* get and output Java version */
say IPversion "- Java Version:" s~getProperty("java.version")
say

/* object proxy definitions */
feedUrl = .bsf~new("java.net.URL", inURL)
input = .bsf~new("com.sun.syndication.io.SyndFeedInput")
feed = input~build(.bsf~new("com.sun.syndication.io.XmlReader", feedUrl))

say "Title: " feed~title()

say "Author: " feed~author()
say "Description: " feed~description()
say "Pub date: " feed~publishedDate~toString
say "Copyright: " feed~copyright()
say "Modules used:"

tab="09"x /* define the TAB character */
iter=feed~getModules~iterator /* get the modules collection and
its iterator */
do while iter~hasNext /* as long as the iterator has an
unprocessed object */
say tab iter~next~uri
end

say "Titles of the "feed~getEntries~size" entries:"

iter=feed~getEntries~iterator /* get feed items */
do while iter~hasNext /* as long as the iterator has an
unprocessed object */
say tab iter~next~title
end

res = feed~image
if feed~image \= .NIL then
do
say "Feed image URL: " feed~image~url
end

exit 0 /* leave program */

--------------- cut here --------------

---rony
.



Relevant Pages

  • Re: BSF4REXX Event Listener
    ... This means that the introspection of the class 'com.sun.syndication.fetcher.impl.HttpURLFeedFetcher' did not yield information about events that class fires. ... publishing RSS and Atom feeds. ... You can parse to an RSS object model, ...
    (comp.lang.rexx)
  • Re: RSS
    ... You have two feeds, both slightly broken. ... RSS 0.91 and the "Atom" feed is a dubious looking Atom 0.3 format. ... doesn't hammer your server on serving every page. ...
    (uk.net.web.authoring)
  • Re: What should you write a new feed in?
    ... Atom etc), what should we create 'new' feeds in, if we're coding them ... from scratch? ... RSS 1.0 is still the most powerful and I use it for internal workflows, ...
    (comp.text.xml)
  • ANN: RSS and Atom syndication of Indezine content
    ... RSS and Atom syndication is available for two areas of Indezine: ... the world of PowerPoint. ... Atom feeds here... ...
    (microsoft.public.powerpoint)
  • Feed Editor Lite 2.8: Create, Edit, and Publish RSS feeds
    ... Company: ExtraLabs Software ... create new RSS feeds from scratch, or modify and enhance existing RSS ... Compared to other RSS editors in its category, Feed Editor Lite ...
    (comp.software.shareware.announce)