This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > February 2004 > selectNodes...combining?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author selectNodes...combining?
Bruce Duncan

2004-02-25, 7:29 pm

I have a simple XML file:
<cart>
<product prodid="12" itemid="30" flavorid="10">5</product>
<product prodid="12" itemid="30" flavorid="12">2</product>
<product prodid="14" itemid="38" flavorid="10">8</product>
</cart>

I wrote 2 separate search functions:
1) set nodefind = bagitems.selectnodes("product
[@itemid=""" & 30 & """]") returns 2
2) set nodefind = bagitems.selectnodes("product
[@flavorid=""" & 10 & """]") returns 2

My Question:
Can I combine the two and get a search result for
itemid=30 and flavorid=10? I only want the 1 record.

I'm using this in ASP. I appreciate any direction you
can give. Thanks.

-Bruce
Han

2004-02-26, 1:29 am

Have you considered "and" operator?

selectnodes("product[@itemid='30' and @flavorid='10']")

--
Pohwan Han, Microsoft MVP, ASP/ASP.Net, Korea
Have a nice day.

"Bruce Duncan" <anonymous@discussions.microsoft.com> wrote in message
news:196d01c3fbf5$12701340$a301280a@phx.gbl...
> I have a simple XML file:
> <cart>
> <product prodid="12" itemid="30" flavorid="10">5</product>
> <product prodid="12" itemid="30" flavorid="12">2</product>
> <product prodid="14" itemid="38" flavorid="10">8</product>
> </cart>
>
> I wrote 2 separate search functions:
> 1) set nodefind = bagitems.selectnodes("product
> [@itemid=""" & 30 & """]") returns 2
> 2) set nodefind = bagitems.selectnodes("product
> [@flavorid=""" & 10 & """]") returns 2
>
> My Question:
> Can I combine the two and get a search result for
> itemid=30 and flavorid=10? I only want the 1 record.
>
> I'm using this in ASP. I appreciate any direction you
> can give. Thanks.
>
> -Bruce



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews