tags:

views:

18

answers:

2

Really simple xpath call but I am having a mindblock.

My XML file looks like this

<?xml version="1.0"?>
<books>
    <book>bob</book>
</books>

I want do an XPATH call to find the node with the value of bob whcih seems to work but whenever I put a no exsistent book value in, it still returns the node of bob. My XPATH Query is

/books/book[.='bob2']

Is my XPATH wrong? Really having a mad brain block!

Steve

A: 

you can just select /books/book and test for equality to "bob2". alternatively, you can use the text() function, but with some caveats.

Scott M.
A: 

Ah Crap! - It was ok, just being an idiot!