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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:13:38+00:00 2026-05-30T22:13:38+00:00

Trying to parse out this xml file to get a list of Elements but

  • 0

Trying to parse out this xml file to get a list of Elements but I’m having difficulties in doing so.

Here’s my Xml file:

<STORES>
  <Stores1>
   <TEST>
    <ClientID>200</ClientID>
    <FormTypeID>101</FormTypeID>
   </TEST>
   <PROD>
    <ClientID>200</ClientID>
    <FormTypeID>102</FormTypeID>
   </PROD>
  </Stores1>
  <Stores2>
   <TEST>
    <ClientID>201</ClientID>
    <FormTypeID>717</FormTypeID>
   </TEST>
   <PROD>
    <ClientID>201</ClientID>
    <FormTypeID>719</FormTypeID>
   </PROD>
  </Stores2>
</STORES>

What I am trying to accomplish is pull back all of child elements depending on what I feed the querys XNames parameter for the Elements method call. Like so

  var elements = (from x in xDoc.Elements("Stores1")
                      where x.Name.LocalName == "TEST"
                      select x).ToList();

So the list would contain all of TEST Elements for Stores1 like this:

<ClientID>200</ClientID>
<FormTypeID>101</FormTypeID>

I get nothing returned at the moment. What am I doing wrong?

  • 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-30T22:13:40+00:00Added an answer on May 30, 2026 at 10:13 pm

    xDoc.Elements("Stores1") returns all of the direct child elements of the document named Stores1.

    You want xDoc.Element("STORES").Element("Stores1").Elements("TEST").Elements(); you don’t need any LINQ

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to parse some XML but apparently this is too much for a lazy
Hi I am trying to parse data out of an XML file I exported
I am trying to pull elements out of a parsed XML file by searching
I am trying to parse an XML file so that I get all of
I'm trying to get my JSP to parse an XML file so that I
I am trying to figure out the best way to parse this comma delimited
I am trying to create a for loop that will parse out different elements
I'm using jQuery to parse an XML file, and I'm trying to push each
I am trying to parse a xml file that i have (using javascript DOM).
I am trying to read a xml file from the web and parse it

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.