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

  • Home
  • SEARCH
  • 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 8246443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:30:26+00:00 2026-06-07T22:30:26+00:00

I have a question regarding polling or detecting changes in XML files on websites.

  • 0

I have a question regarding polling or detecting changes in XML files on websites. I have a pretty hard-coded system below that reads an XML file from the NY Fed about their daily securities lending. It’s working well, and I have no issues with that. My main question is how I poll the website for changes every weekday. I understand that I can check the “Last Modified” field on the XML file (or in this case, the “Prepared” field), but I’m curious about how I go about doing this so that when a change is actually made to the XML site, my computer automatically loads and parses the new XML file. Getting this information as soon as it comes out is extremely important to me, so polling it every X minutes doesn’t really work as well as I would like. Any ideas?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.IO;
using System.Xml.Linq;
using System.Diagnostics;

namespace ConsoleApplication2 {
    class Program {
        static void Main(string[] args) {
            // XML text reader stuff
            //XmlReader textReader = XmlReader.Create("http://www.newyorkfed.org/markets/seclend/xml/v3_0/secLendingXML.cfm");
            XmlTextReader textReader = new XmlTextReader("http://www.newyorkfed.org/markets/seclend/xml/v3_0/secLendingXML.cfm");
            //SyndicationFeed feed = SindicationFeed.Load(textReader);
            //XmlTextReader textReader = new XmlTextReader("LOCATION");
            //string[] Fed_Array = new string[] {"Actual Available to Borrow", "Outstanding Loans",
            //"Par Submitted", "Par Accepted", "WTD Average Rate"};
            int j = 0;
            int icount = 0;
            using(StreamWriter writer = new StreamWriter("LOCATION"))
            //using (StreamWriter writer = new StreamWriter("LOCATION"))    
            while (textReader.Read()) {
                switch (textReader.NodeType) {
                case XmlNodeType.Element:
                    for (int i = 0; i < textReader.AttributeCount; i++) {
                        textReader.MoveToAttribute(i);
                        switch (textReader.Name) {
                        case "securityMaturityDate":
                            string textvalmatd = textReader.Value;
                            if (i == 0 && icount == 0) {
                                writer.Write("N/A,");
                                Console.Write("N/A,");
                                icount = 1;
                                i = -1;
                            } else {
                                writer.Write(textvalmatd + ",");
                                Console.Write(textvalmatd + ",");
                                icount = 0;
                            }
                            break;
                        case "couponRate":
                            string textvalcoup = textReader.Value;
                            writer.Write(textvalcoup + ",");
                            Console.Write(textvalcoup + ",");
                            break;
                        case "securityType":
                            string textvalsec = textReader.Value;
                            writer.Write(textvalsec + ",");
                            Console.Write(textvalsec + ",");
                            j = 0;
                            break;
                        case "value":
                            string textval = textReader.Value;
                            writer.Write(textval + ",");
                            Console.Write(textval + ",");
                            j = j + 1;
                            if (j > 4) {
                                writer.Write(Environment.NewLine);
                                Console.Write(Environment.NewLine);
                            }
                            break;

                        }
                    }
                    break;
                }
            }
        }

        private static IDisposable StreamWriter(string p) {
            throw new NotImplementedException();
        }
    }
}
  • 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-07T22:30:28+00:00Added an answer on June 7, 2026 at 10:30 pm

    Unless the Fed provides some sort of event indicating that a new file is available (which I doubt is the case), the theoretical best that you can do is to download the latest XML file and check if it’s newer than the previous one.

    If the file is really released once per day, you could generate your own statistics on when, exactly, the file is released each day. Intensify your polling in a window surrounding that typical release time (be sure you don’t violate any terms of service in your polling frequency, however).

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

Sidebar

Related Questions

I have question regarding shared memory segmentation in c using POSIX system calls. Is
I have a question regarding jQuery. I have multiple images that are, in essence,
I have a question regarding class design. I want to have a class that
I have a question regarding the threads that my application spawns during execution and
I have a question regarding the several images and sound files in the Media
I have a question regarding inheritance, so I will describe the scenario below: I
I have a question regarding in-app billing. I have a published app that currently
I have a question regarding the verification of executable files, compiled with visual studio,
I have something of an abstract question regarding managing live feeds/polling on web sites.
I have question regarding the SQLAlchemy. How can I add into my mapped class

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.