Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6847895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:48:03+00:00 2026-05-27T00:48:03+00:00

Given the XML below how would I go about getting a list of employees

  • 0

Given the XML below how would I go about getting a list of employees who have a position in the coordinators.coordinator > position_ids?

<employee id="000001">
 <username>Bernard</username>
 <first_name>BERNARD</first_name>
 <last_name>FISHER</last_name>
 <business_phone>011111111111</business_phone>
 <cell_phone>011111111112</cell_phone>
 <hr_contact_name>PETER MANNING</hr_contact_name>
 <contract_description>Permanent</contract_description>
 <positions>
  <position id="00000002" isPrimary="1">
  <title>DEVELOPMENT MANAGER</title>
  <department id="DV001">DEVELOPMENT</department>
  <manager_position>00000002</manager_position>
  <coordinators>
   <coordinator position_id="00013662"/>
   <coordinator position_id="00014488"/>
   <coordinator position_id="00022675"/>
   <coordinator position_id="00024364"/>
  </coordinators>
  </position>
 </positions>
</employee>
<employee id="000002">
<!-- ... --->
</employee>

Here is what I have so far:

//GET EMPLOYEE WITH CORORDINATORS AND SUBORINATES WITH POSITION ID
var q = from c in d.Elements().Elements().Elements("positions").Elements("position") where  (string)(c.Attribute("id")) == "028782"
        select new
            {
                PositionID = c.Parent.Parent.Attribute("id")
                ,Username = c.Parent.Parent.Element("username").Value
                ,FirstName = c.Parent.Parent.Element("first_name").Value
                ,LastName = c.Parent.Parent.Element("last_name").Value                      
                ,ContractDecription = c.Parent.Parent.Element("contract_description").Value
                ,Title = c.Element("title").Value
                ,Coordinators = (from coordinator 
                                in d.Elements().Elements().Elements("positions").Elements("position") 
                                join p in c on coordinator.Attribute("id").Value equals p.Attribute("id").Value

                                select new
                                    {
                                        PositionID = coordinator.Attribute("id")
                                        ,Username = coordinator.Parent.Parent.Element("username").Value
                                        ,FirstName = coordinator.Parent.Parent.Element("first_name").Value
                                        ,LastName = coordinator.Parent.Parent.Element("last_name").Value                            
                                        ,ContractDecription = coordinator.Parent.Parent.Element("contract_description").Value
                                        ,thenode = coordinator
                                    })
                ,thenode = c
            };

q.Dump();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:48:03+00:00Added an answer on May 27, 2026 at 12:48 am

    You can try something like that:

    var coordinatorIds =
        d.Elements("employee")
         .Elements("positions")
         .Elements("coordinators")
         .Elements("coordinator")
         .Select(c => c.Attribute("position_id").Value)
         .Distinct()
         .ToArray();
    
    var coordinators =
        from c in d.Elements("employee")
        join id in coordinatorIds on c.Attribute("id").Value equals id
        select c;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xml given below: <root title=الصفحة الرئيسة> <item title=الصفحة الرئيسة itemuri=tcm:8-29-4 ShowInNav=True
Given a piece of Xml Like the one below. How would I write an
Given the XML below, I need to group by InputItem and sum the costs
Given the XML below, I need to parse it and output names of all
Please see the sample xml given below. As per a requirement, I need to
I am looking to transform a input xml given below <profile name=default> <color id=forecolor
Given the XML/RDF example below taken from the W3C website, how can I access
Say I have this given XML file: <root> <node>x</node> <node>y</node> <node>a</node> </root> And I
I have a given XML document (structure can not be changed) and want to
The function below returns an array of XML files from a given directory including

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.