Solved

XPath Expression

Posted on 2006-06-29
1
506 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now