[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

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?
0
raterus
Asked:
raterus
  • 2
1 Solution
 
zc2Commented:
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

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now