Need Help accessing XML Elements with ASP/ADO

G

gmlear

Yes this looks just like the post below but seeing a was a dumba$$ and
didn't phrase my subject in the form of a question I wasn't gettting
any hits.... So here you go.

Senerio:

I am using MSXML 4.0 , ASP & ADO


I am grabbing numerous RSS News Feeds and trying to parse the data and
insert it into a dB. The problem is that the RSS News feeds are not
all the same when down in the item element.


They ALL contain the nodes: title, description, link and pubDate. But
they come in all different orders and have other child nodes sandwiched
among the ones I am after.


<channel>
<item>
<title>
<description>
<link>
<pubDate>


example: http://rss.news.yahoo.com/rss/­elections
example: http://www.cbsnews.com/feeds/r­ss/main.rss
example: http://rss.cnn.com/rss/si_tops­tories.rss


My code issue is;


When looping through the recordset I have to reference the childnode
numerically ie. item.childnodes.item(0).text,
item.childnodes.item(1).text, item.childnodes.item(2).text


But because I am trying to use the same code for every feed I want to
access the childnodes by their names:
item.childnodes.item(title).te­xt,
item.childnodes.item(descripti­on).text,
item.childnodes.item(link).tex­t
because in some feeds 0=title and in others 0=link etc etc...


I have spent three days searching the net and have not found anything.


Does anyone have a way to do this?


For those that want to give me their .Net solution I am sad to say it
must be done using ASP/ADO.


Please show me the way!!



-Gordon
 
E

earthling

Gordon,

what you need to do is simple parsing. How about looking at the name
of the node? See property localname of XMLNode or the derived class
XMLElement

Giancarlo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top