I have an RSS feed and I was wondering if there is a quick way to list all items that appear between certain XML tags without having to do some back breaking text delimiter stuff.
For example - I want to put all the content that appears between these two title tags Blah. So if there were six title my list would be something like this:
script RSSParser
property tempFile : ""
on downloadFeed(feedURL)
-- Set script-level property; This is the file read by the other handlers
set tempFile to POSIX path of ((path to temporary items folder as Unicode text) & "as_rss_parser.xml")
do shell script "/usr/bin/curl --silent --show-error --output " & quoted form of result & " " & quoted form of feedURL
return true
end downloadFeed
on fetchItemTitles()
tell application "System Events"
tell XML element "channel" of XML element "rss" of XML file tempFile
set titleList to {}
XML elements whose name is "item"
repeat with thisItem in result
set end of titleList to value of XML element "title" of thisItem
end repeat
end tell
end tell
return titleList
end fetchItemTitles
end script
tell RSSParser
downloadFeed("http://bbs.applescript.net/extern.php?action=active&type=RSS")
fetchItemTitles()
end tell
on fetchItemTitles()
tell application "System Events"
return value of XML element "title" of (XML elements whose name is "item") ¬
of XML element "channel" of XML element "rss" of XML file tempFile
end tell
end fetchItemTitles