[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

XPath Expression

Posted on 2006-06-29
1
Medium Priority
?
561 Views
Last Modified: 2008-03-10
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
Comment
Question by:CIPL-Senthil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1000 total points
ID: 17016036
Hi CIPL-Senthil,

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

Cheers!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question