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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:06:49+00:00 2026-05-23T18:06:49+00:00

I am parsing Xml file located in web server and storing parsed data in

  • 0

I am parsing Xml file located in web server and storing parsed data in to database. for my app I am using data from database. I need to parse the xml file only if the file is modified otherwise no need to parse. So how can I know the file is modified? I know I can use “if-modified-since” header. But
I need some examples of “if-modified-since” header
please help me…….

  • 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-23T18:06:50+00:00Added an answer on May 23, 2026 at 6:06 pm

    Since you are retrieving your .xml file from a web server, this should be relatively easy without having to do a server side MD5 sum.

    If you are doing a HTTP request for the xml file you can simply perform a HEAD request from the web server and this will return if the file has changed/modified or if it doesn’t exist. This is also lightweight and the best part is that the server should already do this for you.

    Edit: re-reading your question, looks like you had the same idea. Here’s the code.

    import java.net.*;
    import java.io.*;
    
    // Using HTTP_NOT_MODIFIED
    public static boolean Changed(String url){
        try {
          HttpURLConnection.setFollowRedirects(false);
          HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
          con.setRequestMethod("HEAD");
          return (con.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED);
        }
        catch (Exception e) {
           e.printStackTrace();
           return false;
        }
      }
    
    // GET THE LAST MODIFIED TIME
    public static long LastModified(String url)
    {
      HttpURLConnection.setFollowRedirects(false);
      HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
      long date = con.getLastModified();
    
      if (date == 0)
        System.out.println("No last-modified information.");
      else
        System.out.println("Last-Modified: " + new Date(date));
    
      return date;
    }
    

    See:

    • HttpURLConnection
    • HyperText_Transfer_Protocol HttpStatus 304 (Not Modified)

    Alternatively if your server supports them you can use ETags to find out if your file has been modified.

    • http://www.xpertdeveloper.com/2011/03/last-modified-header-vs-expire-header-vs-etag/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using feedparser for parsing from XML file.But I couldn't parse <geo:lat> ,
I need to insert data from my parsed XML file to mySQL table. Problem
I have 2 questions: 1-I need to parse XML file and insert the data
how to parse HTML tag using XML parsing I am parsing XML file but
Possible Duplicate: Parsing XML in Cocoa iPhone - Can we parse .plist(xml) file using
I am parsing XML file in scala using val data = XML.loadFile(changes.xml) I have
I am parsing xml file data from an url. All works great when device
I am parsing a XML file in Java using the W3C DOM. I am
What is the fastest method of parsing an XML file in C#? I'm using
I got a string from parsing a XML file which looks like this: Fri,

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.