You need to remove the /
before the [
. Predicates (the parts in [
]
) shouldn't have slashes immediately before them. Also, to select the Employee element itself, you should leave off the /text()
at the end or otherwise you'd just be selecting the whitespace text values immediately under the Employee element.
//Employee[@id='4']
Edit: As Jens points out in the comments, //
can be very slow because it searches the entire document for matching nodes. If the structure of the documents you're working with is going to be consistent, you are probably best off using a full path, for example:
/Employees/Employee[@id='4']