[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

XPath Expression

Hi Experts,

I have an XML as follows:

<employee>
<emp>
      <name dptid=1>xyz</name>
      <design>manager</design>
      <sal>20000</sal>
 </emp>
<emp>
      <name dptid=2>abc</name>
      <design>engineer</design>
      <sal>10000</sal>
 </emp>
<emp>
      <name dptid=1>def</name>
      <design>engineer</design>
      <sal>12000</sal>
 </emp>
</employee>

I am using xerces DOMParser with XPath in Java to fetch the nodes.

Now, I want to fetch all the “emp” nodes where the ‘dptid=1’ in the node ‘name’. Could you help me to write the expression in XPath to achieve this?

Thanks & Regards
Vijay T. Prabakar
0
CIPL-Senthil
Asked:
CIPL-Senthil
1 Solution
 
Geert BormansCommented:
Hi CIPL-Senthil,

//emp[name/@dptid='1']

Cheers!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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