Option Public
Option Explicit
Use "UrlFetcherLS"
Use "XmlNodeReader"
Sub Initialize
Dim atomUrl As String
Dim fetcher As New UrlFetcher
Dim response As String
atomUrl = "http://api.flickr.com/services/feeds/photos_public.gne"
response = fetcher.getUrlAsString( atomUrl )
If (Len(fetcher.getLastError()) > 0) Then
Messagebox "Error getting ATOM feed: " + fetcher.getLastError()
Exit Sub
End If
Dim reader As New XmlNodeReader
Call reader.ReadText( response )
If reader.isEmpty Then
Messagebox "Error parsing ATOM feed: " & reader.getLastError()
Exit Sub
End If
Print "ATOM Title = " & reader.get( "feed.title" )
Dim links As Variant
links = ArraysToList( reader.getAll("feed.link.@rel"), reader.getAll("feed.link.@href") )
Print "Site Link = " & links("alternate")
Dim arr As Variant
Dim i As Integer
arr = reader.getNodeReaders("feed.entry")
For i = 0 To Ubound(arr)
Print "Feed Item #" & i+1 & " Title = " & arr(i).get( "title" )
links = ArraysToList( arr(i).getAll("link.@rel"), arr(i).getAll("link.@href") )
Print "Feed Item #" & i+1 & " Link = " & links("alternate")
Next
End Sub
Function ArraysToList (arr1 As Variant, arr2 As Variant) As Variant
Dim count As Integer
count = Ubound(arr1)
If (Ubound(arr2) < count) Then count = Ubound(arr2)
Dim returnVal List As Variant
Dim i As Integer
For i = 0 To count
returnVal(arr1(i)) = arr2(i)
Next
ArraysToList = returnVal
End Function
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.