Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Please Help Me! ASP ~ XML [Thread Next] Re: Please Help Me! ASP ~ XMLTo: NULL Date: 10/2/2004 6:34:00 PM OOPS I missed your xpath.
Your xpath selects not IDs but IDs' parent.
Your xpath should be,
//ProductInfo/ListingIDs/ID
instead of ,
ProductInfo/ListingIDs
<%
set x=createobject("msxml2.domdocument")
x.loadxml
"<ProductInfo><ListingIDs><ID>9392</ID><ID>9393</ID><ID>9394</ID><ID>9395</I
D><ID>9396</ID></ListingIDs></ProductInfo>"
for each n1 in x.selectnodes("*/*/ID")
response.write n1.text & "<br>"
next
%>
"Sarah" <no-spam~sarah@z...> wrote in message
news:smqsl0h52ufr795n2hjibjkjq729dejniu@4......
> Thanks Han... But when I try a "for each" loop like that, it just
> executes one time, and returns all of the IDs in one string....
>
> On Sat, 2 Oct 2004 16:58:13 +0900, "Han" <hp4444@k...>
> wrote:
>
> >Something like,
> >
> >for each id1 in theIDs
> > response.write id1.text & "<br>"
> >next
> >
> >"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
> >
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
