Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Need Help accessing XML Elements with ASP/ADO (http://www.velocityreviews.com/forums/t169008-need-help-accessing-xml-elements-with-asp-ado.html)

gmlear 03-18-2005 07:31 PM

Need Help accessing XML Elements with ASP/ADO
 
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!!


>>>-----O--------> E



-Gordon


earthling 03-19-2005 04:28 AM

Re: Need Help accessing XML Elements with ASP/ADO
 
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

"gmlear" <gordon.lear@gmail.com> wrote in message news:<1111174272.706732.255910@l41g2000cwc.googleg roups.com>...
> 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/=ADelections
> example: http://www.cbsnews.com/feeds/r=ADss/main.rss
> example: http://rss.cnn.com/rss/si_tops=ADtories.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=ADxt,
> item.childnodes.item(descripti=ADon).text,
> item.childnodes.item(link).tex=ADt
> because in some feeds 0=3Dtitle and in others 0=3Dlink 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!!=20
>
>
> >>>-----O--------> E=20

>
>
> -Gordon



All times are GMT. The time now is 12:24 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.