Classic ASP and XML - Selecting a specific node

Hi, I' need to select a specific node in an xml doc... i have this which gives me everything

For Each xmlNode In objXML.documentElement.selectNodes("Data")

but i need a single node and its related nodes that has a specific value.. please see the xml

for example: I need to select only the Data where Bookcode = NEA-CSOP

Thank you

<DocumentElement>
<Data>
  <BookCode>NEA-CSOP</BookCode>
  <BPSday>3</BPSday>
  <BPSwk>6</BPSwk>
  <BPSmth>8</BPSmth>
  <Trackday>-44.6</Trackday>
  <TrackPnL>0</TrackPnL>
  <WAIVImv>0.239</WAIVImv>
  <WAIVexp>0.252</WAIVexp>
  <x90Day>0.256</x90Day>
</Data>

<Data>
<BookCode>NEA-EA1</BookCode>
<BPSday>18</BPSday>
<BPSwk>39</BPSwk>
<BPSmth>44</BPSmth>
<Trackday>-23.5</Trackday>
<TrackPnL>0</TrackPnL>
<WAIVImv>0.219</WAIVImv>
<WAIVexp>0.217</WAIVexp>
<x90Day>0.256</x90Day>
</Data>

<Data>
<BookCode>NEK-MV4</BookCode>
<BPSday></BPSday>
<BPSwk></BPSwk>
<BPSmth></BPSmth>
<Trackday></Trackday>
<TrackPnL></TrackPnL>
<WAIVImv></WAIVImv>
<WAIVexp></WAIVexp>
<x90Day></x90Day>
</Data>
<DocumentElement>

Open in new window

nthawkins1971Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Flabio GatesCommented:
Can you try:
For Each xmlNode In objXML.documentElement.selectNodes("Data[text()='NEA-CSOP']")

Open in new window

0
nthawkins1971Author Commented:
Doesn't seem to work, however it doesnt cause an error.. should I add BookCode in some way... like, Data.BookCode[text()='NEA-CSOP' ?


For Each xmlNode In objXML.documentElement.selectNodes("Data[text()='NEA-CSOP']")
0
Flabio GatesCommented:
Data/BookCode[text()='NEA-CSOP']
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Flabio GatesCommented:
But that would get you the BookCode node.
You'll need to get back up 1 level to the Data node.
Not sure as I'm on my phone but it would look like
Data/BookCode[text()='NEA-CSOP']/parent-node::*
0
Ryan ChongCommented:
try this instead.

Data[BookCode/text()='NEA-CSOP']

Open in new window

1
nthawkins1971Author Commented:
Absolutely perfect! thanks
0
Flabio GatesCommented:
was almost there:
Data/BookCode[text()='NEA-CSOP']/parent::*

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ryan ChongCommented:
well, absolutely perfect but yet not accepted as answer?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Node.js

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.