XPath locate help

Hi, I haven't worked with XPath enough to know this one off the top of my head.

Given this XML snippet
	<appSettings>
		<add key="clientID" value="7" />
                <add key="somethingelse" value="1234" />
	</appSettings>
 	<appSettings>
		<add key="clientID" value="8" />
                <add key="somethingelse" value="5678" />
	</appSettings>
 

Open in new window


I need to be able to locate the "appSettings" block, on a per client basis, so my XPath will specify the clientID to look for.

This is my current flawwed and very non-working example,
//appSettings[add@value="7" and add@key="clientId"]

Can someone steer me in the correct direction?
LVL 33
raterusAsked:
Who is Participating?
 
zc2Connect With a Mentor Commented:
Try this:

//appSettings[add[@value="7" and @key="clientID"]]

Note, the string comparisons are case-sensitive.
0
 
raterusAuthor Commented:
Makes complete sense when I look at it, and it works great!

Thanks
0
 
zc2Commented:
You're welcome
0
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.

All Courses

From novice to tech pro — start learning today.