XPath query for exact match

By : Henno
Source: Stackoverflow.com
Question!

I'd like to search an xml doc (or rather Element with sub elements) for a string. It needs to be an exact match.

Here's a sample of the xml

<Car>
 <Make value="German\Opel"/>
 <Make value="German\Benz"/>
 <Make value="Japanese\Nissan"/>
</Car>
By : Henno


Answers

Further to Obalix's answer, there is a xPath tutorial here that would be quite helpful in answering future questions about building xPath queries.

http://www.w3schools.com/xpath/default.asp

Enjoy



Assuming you want to return the elements based on the string in the value propery, you can use the following xpath with your example:

/Car/Make[@value = 'German\Opel']

The part in the square brackets is called a predicate and acts as a filter to the expression before.



This video can help you solving your question :)
By: admin