Solved

XPath Expression

Posted on 2006-06-29
1
531 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
1 Comment
 
LVL 60

Accepted Solution

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

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

Cheers!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What XAML would produce this? 3 81
XML to SQL Table using c# 5 64
c# code 19 71
Powershell XML in variable 4 21
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 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