Hi!
Here's a XML reprensenting a company. I would like to make a XPath
query that gives me all the employees that are Programmer or Analyst
and have 5 years of experience.
I did the following query
"//*[local-name()='Employee']/*[(local-name()='Position' and
(text()='Programmer' or
text()='Analyst'))]//parent::*/*[(local-name()='YearsOfExperience' and
text()='5')]//parent::*" and it gives me 4 nodes. The 2 I need and one
for Position and another for YearsOfExperience.
Please help me to get through this!
I'm using VB.net and I cannot change the xml structure. I would like to
return it as an XML document.
Here's my XML file:
<Company xmlns="http://www.mynamespace.com/MyCompany">
<Id>1</Id><Name>MyCompany Name</Name>
<ListOfEmployees>
<Employee>
<Number>65239</Number>
<Position>Programmer</Position>
<Name>Johnny</Name>
<Firstname>McDonald</Firstname>
<YearsOfExperience>5</YearsOfExperience>
</Employee>
<Employee>
<Number>18544</Number>
<Position>Boss</Position>
<Name>The Kid</Name>
<Firstname>Billy</Firstname>
<YearsOfExperience>21</YearsOfExperience>
</Employee>
<Employee>
<Number>23463</Number>
<Position>Analyst</Position>
<Name>King</Name>
<Firstname>Kerry</Firstname>
<YearsOfExperience>5</YearsOfExperience>
</Employee>
</ListOfEmployees>
</Company>
Thanks!
Jeff