Re: BSF4REXX implementation of Java fragment
- From: rony <Rony.Flatscher@xxxxxxxxxxxxx>
- Date: Thu, 05 Jun 2008 23:35:52 +0200
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
.
- Follow-Ups:
- Re: BSF4REXX implementation of Java fragment
- From: regli
- Re: BSF4REXX implementation of Java fragment
- References:
- BSF4REXX implementation of Java fragment
- From: regli
- Re: BSF4REXX implementation of Java fragment
- From: rony
- Re: BSF4REXX implementation of Java fragment
- From: rony
- Re: BSF4REXX implementation of Java fragment
- From: regli
- Re: BSF4REXX implementation of Java fragment
- From: regli
- Re: BSF4REXX implementation of Java fragment
- From: regli
- BSF4REXX implementation of Java fragment
- Prev by Date: Re: Database capabilities?
- Next by Date: Re: BSF4REXX implementation of Java fragment
- Previous by thread: Re: BSF4REXX implementation of Java fragment
- Next by thread: Re: BSF4REXX implementation of Java fragment
- Index(es):
Relevant Pages
|