parse OPML

admin

Administrator
Staff member
I'm trying to create a OPML parser in ASP (VBscript), but am having trouble. Here is a snippet of my OPML (my rss reader program generated this OPML):

<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
<head>
<title>myChannels.opml</title>
<dateCreated>Wed 23 Aug 2006 01:44:05 GMT</dateCreated>
</head>
<body>
<keywords>
</keywords>
<outline text="News" description="" xmlUrl="" type="rss" htmlUrl="">
<outline text="NPR" type="rss" xmlUrl="http://www.npr.org/rss/podcast.php?id=1090" />
<outline text="60 Minutes" xmlUrl="http://www.cbsnews.com/common/includes/podcast/podcast_60min_1.rss" />
<outline text="Andy Rooney" xmlUrl="http://www.cbsnews.com/common/includes/podcast/podcast_rooney_1.rss" />
</outline>
<outline text="Tech" description="" xmlUrl="" type="rss" htmlUrl="">
<outline text="Tech Nation" xmlUrl="http://rss.conversationsnetwork.org/rss.php?series=technation" />
<outline text="Pocket PC Thoughts" xmlUrl="http://www.pocketpcthoughts.com/xml/thoughtcast.xml" />
<outline text="PC Gamer Video Podcast" xmlUrl="http://www.pcgamerpodcast.com/video/?feed=rss2" />
</outline>
</body>
</opml>

What I'm trying to do is capture the data in groups to enter into a database. So I need to capture the "News" attribute,
then all the nodes under it ("NPR","60 Minutes","Andy Rooney") and the same with "Tech".

Here is the code I have so far:

sOpml = "myFeeds.opml"

Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.setProperty "ServerHTTPRequest", True

If objXML.load(sOpml) Then

Set objItemList = objXml.selectNodes("/*/body")
iTotalItems = objItemList.length - 1

For iCount = 0 to iTotalItems
Set objItem = objItemList.item(iCount)

For j = 0 to objItem.childNodes.length - 1
response.write objItem.childNodes(j).getAttribute("text") & "<br>"
Next

Next
End If

This code will just print out "News","Tech". How can I get it so I can get "News", enter it into a table, then get the attributes under "News", and enter into a table as well. Thanks in advance.
 
Back
Top