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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:04:06+00:00 2026-06-15T04:04:06+00:00

I have an XML file that is constantly being appended to. I need to

  • 0

I have an XML file that is constantly being appended to. I need to read in the data from the XML repeatedly, but on each pass I do not want to retrieve data that I have processed in the previous run.

Since I know how long the file is at the time of processing, I figure I could use the length of the file (minus the ending /Contacts tag) to determine where I last left off. Knowing this, what is the best way to retrieve all of the Contact tags starting from a particular byte position within the file?

<?xml version="1.0"?>
<Contacts>
    <Contact>
      <Name>Todd</Name>
      <Email>todd@blah.com</Email>
  </Contact>
    <Contact>
      <Name>Sarah</Name>
      <Email>sarah@blah.com</Email>
  </Contact>
</Contacts>

This block of code grabs all of the contacts. I would like to limit it so it only picks up data after the first contact (at byte 116.)

var xdoc = XDocument.Load(PATH_TO_FILE);
var contact = xdoc.Descendants("Contact").Select(x => (string)x).ToArray();
  • 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-15T04:04:07+00:00Added an answer on June 15, 2026 at 4:04 am

    I found a way to save/retrieve by index position. This will work just as well.

    int position = 1;
    var contacts = xdoc
        .Descendants("Contact")
        .Select((x, index) => new { Contact = x, Index = index })
        .Where(x => x.Index >= position)
        .Select(x => x.Contact);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file that I'm trying to read from here , and
I have an XML file that has a number of nodes, each of which
I have an XML file that is very long, but here is a shot
I have some xml files that will be read-only that I need to access
I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>
I have an XML file that reads like this <abc> <ab>value</ab> <aa>time</aa> <ac>money</ac> </abc>
I have an XML file that is well formed and valid (matched with an
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have an XML file that lists a series of items, and the items
I have an XML file that I'm trying to serialize into an object. Some

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.