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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:58:10+00:00 2026-06-03T12:58:10+00:00

I have a folder with 400k+ XML-documents and many more to come, each file

  • 0

I have a folder with 400k+ XML-documents and many more to come, each file is named with ‘ID’.xml, and each belongs to a specific user. In a SQL server database I have the ‘ID’ from the XML-file matched with a userID which is where I interconnect the XML-document with the user. A user can have an infinite number of XML-document attached (but let’s say maximum >10k documents)

All XML-documents have a few common elements, but the structure can vary a little.

Now, each user will need to make a search in the XML-documents belonging to her, and what I’ve tried so far (looping through each file and read it with a streamreader) is too slow. I don’t care, if it reads and matches the whole file with attributes and so on, or just the text in each element. What should be returned in the first place is a list with the ID’s from the filenames.

What is the fastest and smartest methods here, if any?

  • 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-03T12:58:16+00:00Added an answer on June 3, 2026 at 12:58 pm

    I think LINQ-to-XML is probably the direction you want to go.

    Assuming you know the names of the tags that you want, you would be able to do a search for those particular elements and return the values.

    var xDoc = XDocument.Load("yourFile.xml");
    
    var result = from dec in xDoc.Descendants()
                 where dec.Name == "tagName"
                 select dec.Value;
    

    results would then contain an IEnumerable of the value of any XML tag that has has a name matching “tagName”

    The query could also be written like this:

    var result = from dec in xDoc.Decendants("tagName")
                 select dec.Value;
    

    or this:

    var result = xDoc.Descendants("tagName").Select(tag => tag.Value);
    

    The output would be the same, it is just a different way to filter based on the element name.

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

Sidebar

Related Questions

I have folder on which i want to apply security like the current user
I have one folder named library where I have put all my JAR files.
I have folder C:\Temp\ which has two file des.exe and input.abcd. des.exe is used
I have a folder with a __init__.py File __init__.py: #!/usr/bin/python2 flags=test File main.py: #!/usr/bin/python2
I have one folder named Images in my project. I want to get the
Environment: Windows7 64 bit/ C# I have folder named Folder50, which has 50 files
I want to provide styles changing for user in application. I have folder with
I have folder home/admin. In this folder there is index.php. When i access to
I have a folder called Etc which has an image I want to use
We have a folder where our app will be potentially reading, writing and creating/deleting

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.