VFP: Fetch XML feed

Interpreting XML Feed in Visual Foxpro

Looking for ways to interpret XML files I stumbled on this article at the foxite.com forum. This was still way too difficult in my opinion. So I used the methods and created some lean code that does what I want in far less code.

This piece of program retrieves a feed from the Dutch public-services network and lists all items:

lcFeed = [http://feeds.livep2000.nl/]
lcFile = UrlToFile(lcFeed)

oXML = CREATEOBJECT("MSXML2.DOMDocument")
oXML.load(lcFile)
oItems = oXML.getElementsByTagName([item])
FOR EACH oItem IN oItems
 FOR EACH oLine IN oItem.childNodes
  ? oLine.nodeName+[: ]+oLine.text
 ENDFOR 
ENDFOR

Leave a Reply

Your email address will not be published. Required fields are marked *