We help IT Professionals succeed at work.
Get Started

working with XML in C#

Alex A
Alex A asked
on
286 Views
Last Modified: 2013-11-19
The XML data sample below represents a family tree:
<FAMILY>
      <PERSON id="1" name="name_1">
            <PERSON id="11" name="name_11"></PERSON>
            <PERSON id="12" name="name_12">
                  <PERSON id="121" name="name_121"></PERSON>
            </PERSON>
            <PERSON id="13" name=“name_13”></PERSON>
      </PERSON>
      <PERSON id="2"></PERSON>
      <PERSON id="3">
            <PERSON id="31" name=“name_31”></PERSON>
            <PERSON id="32" name=“name_32”></PERSON>
            <PERSON id="32" name=“name_33”></PERSON>
      </PERSON>
</FAMILY>
I need help with writing the function GetDescendants(string id), where the input parameter is the id of a node whose descendants we want to return.  The id’s should be returned in an array sorted by generation.  E.g. GetDescendants(“1”) would return [array(“11”, “12”, “121”)].

Any help appreciated. Thanks.

Comment
Watch Question
Senior Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE