Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Please Help Me! ASP ~ XML

From: "Han" <hp4444@------.---.----->
To: 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
> >
>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent