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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:05:45+00:00 2026-05-21T04:05:45+00:00

In my application, lots of data is generated and then written in a XML

  • 0

In my application, lots of data is generated and then written in a XML file using XmlDocument.
The mechanics works fine, but when I call the function that serializes again and again to write data in a new XML, it copies what it wrote previously to the new XML plus the new data!

I don’t understand, I’m calling XmlDocument doc = new XmlDocument() at the beggining of the function that serializes…

        private static Boolean SaveParsedDataAsXML(ParsedData DataParsed, String Name)
        {
            try
            {
                XmlDocument doc = new XmlDocument();

                XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
                doc.AppendChild(xmlnode);

                XmlElement generalVariables = doc.CreateElement("Variables");

                generalVariables.AppendChild(SerializeElement(doc, "Path", DataParsed.Path));
. 
.
.
            XmlElement chatMessages = doc.CreateElement("ChatMessages");
            foreach (Message mess in DataParsed.ChatMessages)
            {
                XmlElement singleMess = doc.CreateElement("SingleMessage");

                singleMess.AppendChild(SerializeElement(doc, "MessageID", mess.MessageID.ToString()));
                singleMess.AppendChild(SerializeElement(doc, "MessageName", mess.MessageName));
                singleMess.AppendChild(SerializeElement(doc, "MessageTime", mess.MessageTime.ToString()));
                singleMess.AppendChild(SerializeElement(doc, "MessageContent", mess.MessageContent));
                singleMess.AppendChild(SerializeElement(doc, "MessageTarget", mess.MessageTarget.ToString()));

                chatMessages.AppendChild(singleMess);
            }


           generalVariables.AppendChild(chatMessages);
.
.
.
                doc.AppendChild(generalVariables);

                //Saving and returning true, serialization successful.
                doc.Save(OutputPath + "\\" + ReplayName + ".xml");               

                return true;
            }
            catch
            {
                return false;
            }
        }
  • 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-21T04:05:46+00:00Added an answer on May 21, 2026 at 4:05 am

    My assumption would be that you’re not clearing the DataParsed.ChatMessages object before you pass it in to the function you posted.

    Are you sure you’re using a new DataParsed object each time? Or are you re-using the same instance and appending more messages to it?

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

Sidebar

Related Questions

I have written a Ruby application which parses lots of data from sources in
I have a C++ application that loads lots of data from a database, then
I am developing an iPhone application in which I am loading lots of data
My application is having memory problems, including copying lots of strings about, using the
There are lots of tutorials/instructions on how to embed python in an application, but
I have an application that loads lots of data into memory (this is because
In my application I have lots of different data types, e.g. Car, Bicycle, Person,
The application consists of lots of runtime generated grids and charts. Coloring of gridcells
I'm building an application that stores lots of data per user (possibly in gigabytes).
My application needs lots of memory and big data structure in order to perform

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.