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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:50:17+00:00 2026-05-27T16:50:17+00:00

Q: I allow my user to upload an xml file to insert its contents

  • 0

Q:

I allow my user to upload an xml file to insert its contents in my database.

I ask if there’s some idea to know the attributes which have been changed to update the equivalent fields in my database without uploading the updated file again(clear all the data related to this file and insert it again).

Is there some way rather than a form .

My xml snip:

<day name="Saturday" short="Sa" day="0"/>
<day name="Sunday" short="Su" day="1"/>
<day name="Monday" short="Mo" day="2"/>
<day name="Tuesday" short="Tu" day="3"/>
<day name="Wednesday" short="We" day="4"/>
<day name="Thursday" short="Th" day="5"/>

My .cs snip :

                        List<Day> days = new List<Day>();//List of days.
                        IEnumerable<DayNode> resultDays = ReadDayNodes(targetFileName);
                        foreach (DayNode name in resultDays)
                        {
                            Day day = new Day();

                            if (!string.IsNullOrEmpty(ddl_batch.SelectedValue))
                                day.BatchNum = int.Parse(ddl_batch.SelectedValue);
                            if (!string.IsNullOrEmpty(ddl_department.SelectedValue))
                                day.DepCode = int.Parse(ddl_department.SelectedValue);
                            if (!string.IsNullOrEmpty(ddl_study.SelectedValue))
                                day.StudyCode = int.Parse(ddl_study.SelectedValue);
                            if (!string.IsNullOrEmpty(name.Day))
                                day.DayId = name.Day;
                            day.ShortName = name.Short;
                            day.Name = name.Name;
                            days.Add(day);
                        }
    /********************************************************************************************************************/
            private struct DayNode
            {
                public string Name { get; private set; }
                public string Short { get; private set; }
                public string Day { get; private set; }
                public DayNode(string Name, string Short, string Day)
                    : this()
                {
                    this.Name = Name;
                    this.Short = Short;
                    this.Day = Day;
                }
            }
        /********************************************************************************************************************/
        private static IEnumerable<DayNode> ReadDayNodes(string filePath)
        {
            using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            using (XmlReader xrdr = new XmlTextReader(fs))
                while (xrdr.Read())
                    if (xrdr.NodeType == XmlNodeType.Element && xrdr.LocalName == "day")
                        yield return new DayNode(xrdr.GetAttribute("name"), xrdr.GetAttribute("short"), xrdr.GetAttribute("day"));
        }
        /********************************************************************************************************************/
          resultDay = CommonUitilities.InsertDays(days);
  • 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-27T16:50:18+00:00Added an answer on May 27, 2026 at 4:50 pm

    You may pass InputStream (FileUpload#PostedFile) object of uploaded file to the XDocument.Load() method (Linq-XML) to read/parse XML document. After that you may compare xml data against the database.

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

Sidebar

Related Questions

I'm looking for a way to allow a user to upload a large file
Does anyone know if a there is a control to allow the user to
I am using php and i have written codes to allow a user upload
I want to create a Web app which would allow the user to upload
I'm working on a Silverlight app that would allow a user to upload a
I'm trying to build a website that will allow user to upload video files
I'm writing a web application that allow user upload their files on the app.
I am trying to allow the user to upload as many images as they
I'm working on a page that will allow a user to upload a photo
On my asp.net 4.0 site I have a upload function which allow a user

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.