PHP XPATH Mind Melt
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 return开发者_JAVA技巧s the node of bob. My XPATH Query is
/books/book[.='bob2']
Is my XPATH wrong? Really having a mad brain block!
Steve
you can just select /books/book
and test for equality to "bob2". alternatively, you can use the text() function, but with some caveats.
精彩评论