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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:36:12+00:00 2026-06-02T06:36:12+00:00

There is a question that does almost exactly what I want to do by

  • 0

There is a question that does almost exactly what I want to do by almost the same name, however I don’t know what my XML DOM will look like ahead of time.

I would like to do something like this:

private static IEnumerable<XElement> FindAllContainers(XDocument xml)
{
          IEnumerable<XElement> query = from XElement outer in xml.Root.Elements()
                                        from XElement node in outer.Elements()
                                        where true //Enum.IsDefined(typeof(Role), GetContainerRole(node)) 
                                        select node;
                                        return query;
}

The basic Idea is I want to query against an enumeration of all XElements for any given XML structure. The above code doesn’t return any results. With xml containing a large nested XML structure and being an XDocument. The other question manually supplies Elements with the tag names. I don’t know what they are ahead of time to set it up statically in the method.

  • 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-02T06:36:13+00:00Added an answer on June 2, 2026 at 6:36 am

    So it sounds to me like you just want to enumerate through all elements within the document. Well nothing complicated here, just call the Descendants() method (with no arguments) and it will return all elements within the document.

    private static IEnumerable<XElement> FindAllContainers(XDocument doc)
    {
        return doc.Descendants();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there is a question about that, but there isn't any good answer(for
Found this question that explained a way to communicate between layers. However there is
Yes, there is a similar question here . However, that question doesn't seem to
Question Is there a way to have a method that will always run anytime
Firstly I know that there are many question and solutions to correct thread marshalling
There is a question here in stackoverflow with the same title but that is
I am going to ask a question that might sound weird. Is there a
There is a question in my programming languages textbook that is as follows: Write
This question assumes there's a blessed central repository that members of a team clone
Short version question : Is there navigator.mozIsLocallyAvailable equivalent function that works on all browsers,

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.