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 8344783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:28:34+00:00 2026-06-09T06:28:34+00:00

<Contacts> <Node> <ID>123</ID> <Name>ABC</Name> </Node> <Node> <ID>124</ID> <Name>DEF</Name> </Node> </Contacts> Here i want to

  • 0
<Contacts>
       <Node>
           <ID>123</ID>
           <Name>ABC</Name>
       </Node>
       <Node>
           <ID>124</ID>
           <Name>DEF</Name>
       </Node>
</Contacts>

Here i want to get Element name(Tag Name) such as Contacts,*Node*,ID,*Name* using linq to xml concept.What should i do for that.

  • 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-06-09T06:28:35+00:00Added an answer on June 9, 2026 at 6:28 am

    Try this:

    var xml = @"<Contacts>
                        <Node>
                            <ID>123</ID>
                            <Name>ABC</Name>
                        </Node>
                        <Node>
                            <ID>124</ID>
                            <Name>DEF</Name>
                        </Node>
                </Contacts>";
    var xdoc = XDocument.Parse(xml);
    var namelist = xdoc.Descendants()
                        .Select(i => i.Name.ToString())
                        .Distinct()
                        .ToList();
    

    You will get:

    {"Contacts","Node","ID","Name"}
    

    If you want to get the name list of first node

    var nodes = xdoc.Descendants(XName.Get("Node"));
    var firstNode = nodes.First();
    var namelist = firstNode.Descendants()
                        .Select(i => i.Name.ToString())
                        .Distinct()
                        .ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use node.js as REST API. There are following actions available: /contacts, GET, finds
The details of the contacts not displayed properly by using this code. I am
I am calling a contacts list from a MySQL database using AJAX in PHP
I have a contacts table: ID NAME --- ---- 1 KK 2 JKI 3
I have seen the Contacts in iPhone Simulator. I want to create an application
When I have 2 set of nodes with same element name for ex :
I want by linq save my xml in csv and I have o problem.
The standard way to remove a node using PHP's DOMDocument is: $dom = dom_import_simplexml($node);
Ok, here's the problem: I have a list of contacts, which i have created
I am using php DOMDocument to replace a node and then rewrite the page.

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.