Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Please Help Me! ASP ~ XML [Thread Next] Re: Please Help Me! ASP ~ XMLTo: NULL Date: 10/2/2004 11:03:00 AM "Sarah" <no-spam~sarah@z...> wrote in message
news:a06sl0146gjhl2043vsisvri10hp111pfp@4......
> Hi,
>
> I know virtually nothing about XML, and am trying to make someone
> else's code work now that the XML data we're using has changed.
>
> The ASP being used to grab the XML is:
>
> set xmlHTTP = server.CreateObject("Msxml2.SERVERXMLHTTP")
> xmlHTTP.Open "GET", XMLURL, false
> xmlHTTP.Send(Now)
> set xmlDoc = xmlHTTP.responseXML
>
> The XML file looks something like this:
>
> <ProductInfo>
> <ListingIDs>
> <ID>9392</ID>
> <ID>9393</ID>
> <ID>9394</ID>
> <ID>9395</ID>
> <ID>9396</ID>
> </ListingIDs>
> </ProductInfo>
>
> If I do:
>
> set theIDs = xmlDoc.SelectNodes("//ProductInfo/ListingIDs")
>
> it gives me all the <ID> tags combined into one. That is, theIDs
> contains all of the <ID> tags.
>
> I've tried using a "for each" loop to get them out one by one, but I
> can't figure out how to make it work.
>
> Can someone please, please, please help?
>
> Thanks!
>
> -Sarah
If you want all the ID's separately modify your XPATH to
set theIDs = xmlDoc.SelectNodes("/ProductInfo/ListingIDs/ID")
For iIndex = 0 To theIDs.count - 1
Set oID = theIDs.item(iIndex)
'Do something, you now have an ID node, oID with oID.text equal to the
individual ID values.
Next
--
Joe (MVP - xml)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
