brett:
will tell you about a rebol experience i had today. For me it illustrated
the extreme simplicity of rebol:
i asked a question concerning XML parsing, received an example (thanks martin!)
looked at it for a minute, and within 5 minutes i had a first version of
something i wanted to do a long time, but did not
want to make in python/perl:
maybe this is not a direct answer to your question, but to my knowledge, no
scripting language makes it this easy
(btw, getting it in rebol/view will take as long as it takes to write this
e-mail)
hendrik-jan
---------------------------------------------------------------------
REBOL [
Title: "Moreover XML feed parser"
File: %moreover.r
Author: "Martin Johannesson"
Email: [EMAIL PROTECTED]
Date: 30-May-2000
Purpose: {
Parse XML news feeds from Moreover, script modified by HJ Bosch
([EMAIL PROTECTED]).
}
]
;;; All the Moreover XML feeds are listed here:
;;; http://w.moreover.com/categories/category_list_xml.html
;;;
;;; I'm reading the Linux news feed in this script.
feed-url: http://p.moreover.com/cgi-local/page?index_linux+xml
;;; Store articles in this block after parsing.
articles: []
;;; Read XML text from feed.
print "Reading XML feed"
xml-data: read feed-url
f: open/new %moreover.html
append f {<html><head><STYLE TYPE="text/css">table.tablefeed
{border-width:thin; border-style:solid;border-color:black;color: }
td.headline_text { border-width:thin;
border-style:solid;border-color:black;color: black; font-weight:
bold;}</style></head><body><TABLE class=tablefeed>}
;;; Parse XML data.
parse-tree: parse-xml xml-data
;;; The Moreover DTD is not very complicated.
;;; It's easy to traverse the parse tree.
handle-moreovernews: func [
tag
/local
article
][
foreach article-tag tag/3 [
if block? article-tag [
article: compose ["id" (select article-tag/2 "id")]
foreach field-tag article-tag/3 [
if block? field-tag [
append article reduce [
field-tag/1
trim/lines field-tag/3/1
]
]
]
append/only articles article
]
]
]
handle-moreovernews parse-tree/3/1
;;; Print all headlines
foreach article articles [
source: select article "source"
headline_text: select article "headline_text"
document_url: select article "document_url"
url: rejoin [{<a href="} document_url {">} headline_text {</A><BR>}]
test: rejoin
[
{<TR><TD class=headline_text>} source {</TD><TD>} url {</TD></TR>}
]
append f test
]
append f "</table></body></html>^/"
close f
quit
-----------------------------------------------------